Finding Prefixes

Given a set of N strings, count how many of M query strings appear as a prefix of at least one string in the set.

Medium5TrieStringInterviewNo attempts yetTime limit1sMemory limit1536 MB

Problem

A prefix of a string SS is a substring that starts at the very beginning of SS. For example, the prefixes of SS = "codeplus" include "code", "co", "codepl", and "codeplus", while "plus", "s", "cude", and "crud" are not prefixes.

You are given a set SS of NN strings.

Write a program that counts how many of the MM given strings are a prefix of at least one string in the set SS.

Input

The first line contains the numbers of strings NN and MM (1N10,0001 \le N \le 10{,}000, 1M10,0001 \le M \le 10{,}000).

Each of the next NN lines contains one string of the set SS.

Each of the next MM lines contains one string to check.

Every string in the input consists only of lowercase English letters, and its length does not exceed 500. The set SS never contains the same string twice.

Output

Print on the first line the number of the MM strings that are a prefix of at least one string in the set SS.