#include <iostream>
#include <cstring>
using namespace std;
#define LMAX 310
#define WMAX 610
int DP[LMAX];
string str[WMAX];
char msg[LMAX];
int W, L;
void comp( const int& strID, const int& msgPos ){
int strLen = str[strID].length();
if( msgPos < strLen - 1 )
return;
int tmpMsgPos = msgPos;
int strPos;
for( strPos = strLen - 1; strPos >= 0; ){
if( str[strID][strPos] == msg[tmpMsgPos] ){
--strPos;
}
--tmpMsgPos;
if( tmpMsgPos == -1 )
break;
}
if( strPos == -1 && tmpMsgPos == -1 )
DP[msgPos] = min( DP[msgPos] ,msgPos - strLen + 1 );
else if( strPos == -1 && tmpMsgPos != -1 )
DP[msgPos] = min( DP[msgPos], DP[tmpMsgPos] + msgPos - tmpMsgPos - strLen );
}
void DPSolve(){
DP[0] = 1;
for( int msgPos = 1; msgPos < L; ++msgPos ){
DP[msgPos] = DP[msgPos - 1] + 1;
for( int strID = 0; strID < W; ++strID )
comp( strID, msgPos );
}
cout << DP[strlen( msg ) - 1];
}
int main(){
cin >> W >> L;
cin >> msg;
for( int i = 0; i < W; ++i )
cin >> str[i];
DPSolve();
return 0;
}