#!/bin/bash

read price num

disNumArray=()
read disNum
disNumArray+=($disNum)

#1円ずつループを更新
for pay in $(seq ${price} 999999)
do
  isDislikeNumber=0
  for disNum in ${disNumArray[@]} ; do
    if [[ ${pay} =~ ${disNum} ]] ; then
      isDislikeNumber=1
      break
    fi
  done

  if [ $isDislikeNumber = 0 ] ; then
    echo "${pay}"
    break
  fi
done
