process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  var lines = chunk.split("\n");
  var n = lines[0] * 1;
  var name = lines[1];
  var i, iLen, j, jLen, d, dLen,
      cnt=0;
  
  iLen = n+2;
  for (i=2; i<iLen; i++) {
    var board = lines[i], able = false;
    jLen = board.length;
    for (j=0; j<jLen; j++) {
      var d, dLen;
      dLen = board.length; 
      for (d=1; d<=dLen; d++) {
        var idx = j;
        var str = '';
        while(board[idx]) {
          str += board[idx];
          if (str == name) {
            able = true;
          }
          if (able) { break; }
          idx += d;
        }
        if (able) { break; }
      }
      if (able) { break; }
    }
    if (able) {
      cnt++;
    }
  }
  console.log(cnt);
});