Awk:Comparing and matching two file

Dear All,
I have 2 files as follows
file1.txt

261187210101|r
261187210101|r
261187220101|y
261187220102|y
261187220103|y
261187231011|b
261187231011|b
261187241012|g
261187241012|g

file2.txt

1187220
1187241

output:

file1 |file2 |match

261187220101|y 1187220 |ok
261187220102|y 1187220 |ok
261187220103|y 1187220 |ok
261187241012|g 1187241 |ok
261187241012|g 1187241 |ok

how to match the two files above

Please use code tags for code and data sample.

Try

awk 'NR==FNR{A[$0]=$0;next}
FNR==1{print "file1 |file2 |match"}
{for(i in A){if($0 ~ i){print $0,i,"|ok"}}}' file2 file1
awk 'FNR==NR{a[$1];next}
{for(i in a)
  if(index($1,i)) {
   print $0,i,"|ok"
   break
  }}' file2 FS=\| file1

Awk works well,

Thank's Pamu and Elixir_sinari .