#include<bits/stdc++.h>
using namespace std;

#define ll long long int
#define pb push_back
#define mp make_pair

void solve(){
//    time_t start, end;
//
//    time(&start);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n,k,c,i,count=0,presents=0;
    cin>>n>>k;
    cin>>c;
    int a[c];
    for(i=0;i<c;i++){
        cin>>a[i];
    }

    i=0;
    for(int j=0;j<=n;j+=k){
        presents++;
        if(j==a[i] && i<c) i++;
        else if(j>a[i] && i<c){
            j=a[i];
            i++;
        }
    }
    //cout<<i;
    if(i<=c-1){
        presents+= c-i;
    }
    cout<<presents-1;

//    time(&end);
//    double time_taken = double(end - start);
//    cout << "Time taken by program is : " << fixed
//         << time_taken << setprecision(5);
//    cout << " sec " << endl;

}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t;
    t=1;
    //cin>>t;

    while(t--){
        solve();
        }

   }


#include<bits/stdc++.h>
using namespace std;

#define ll long long int
#define pb push_back
#define mp make_pair

void solve(){
//    time_t start, end;
//
//    time(&start);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n,k,c,i,count=0,presents=0;
    cin>>n>>k;
    cin>>c;
    int a[c];
    for(i=0;i<c;i++){
        cin>>a[i];
    }

    i=0;
    for(int j=0;j<n+k;j+=k){
        presents++;
        if(j==a[i] && i<c) i++;
        else if(j>a[i] && i<c){
            j=a[i];
            i++;
        }
    }
    cout<<presents-1;

//    time(&end);
//    double time_taken = double(end - start);
//    cout << "Time taken by program is : " << fixed
//         << time_taken << setprecision(5);
//    cout << " sec " << endl;

}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t;
    t=1;
    //cin>>t;

    while(t--){
        solve();
        }

   }


#include<bits/stdc++.h>
using namespace std;

#define ll long long int
#define pb push_back
#define mp make_pair

void solve(){
//    time_t start, end;
//
//    time(&start);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n,k,c,i,count=0,presents=0;
    cin>>n>>k;
    cin>>c;
    int a[c];
    for(i=0;i<c;i++){
        cin>>a[i];
    }

    i=0;
    for(int j=1;j<=n;j+=k){
        presents++;
        if(j==a[i] && i<c) i++;
        else if(j>a[i] && i<c){
            j=a[i];
            i++;
        }
    }
    cout<<presents;

//    time(&end);
//    double time_taken = double(end - start);
//    cout << "Time taken by program is : " << fixed
//         << time_taken << setprecision(5);
//    cout << " sec " << endl;

}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t;
    t=1;
    //cin>>t;

    while(t--){
        solve();
        }

   }


#include<bits/stdc++.h>
using namespace std;

#define ll long long int
#define pb push_back
#define mp make_pair

void solve(){
//    time_t start, end;
//
//    time(&start);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n,k,c,i,count=0,presents=0;
    cin>>n>>k;
    cin>>c;
    int a[c];
    for(i=0;i<c;i++){
        cin>>a[i];
    }

    i=0;
    for(int j=0;j<=n;j+=k){
        presents++;
        if(j==a[i] && i<c) i++;
        else if(j>a[i] && i<c){
            j=a[i];
            i++;
        }
    }
    cout<<presents-1;

//    time(&end);
//    double time_taken = double(end - start);
//    cout << "Time taken by program is : " << fixed
//         << time_taken << setprecision(5);
//    cout << " sec " << endl;

}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t;
    t=1;
    //cin>>t;

    while(t--){
        solve();
        }

   }


#include<bits/stdc++.h>

using namespace std;

void input()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
    #endif
}
#define endl "\n"
#define ll long long int
#define vll vector<double>
#define pb push_back
#define pll pair<ll,ll>
#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define tll tuple<ll,ll,ll>
#define mt make_tuple
#define INF LONG_LONG_MAX
#define mod 1000000007
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define cases ll t; cin>>t; while(t--)
#define array(a,n) vll a(n); rep(i,0,n) cin>>a[i];
#define sortall(a) sort(a.begin(),a.end())
#define printall(a) rep(i,0,a.size()) cout<<a[i]<<" "; cout<<endl;

// --------------- My Template End --------------- //

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    input();
 	ll ans=0,n,k;
 	cin>>n>>k;
 	ll c;
 	cin>>c;
 	array(a,c);
 	ll curr=0,i=0;
 	while(curr<=n)
 	{
 		curr+=k;
 		if(curr>=a[i]&&i<c)
 		{
 			curr=a[i];
 			i++;
 		}
 		if(curr<=n)
 		ans++;
 	}
 	cout<<ans<<endl;
}


#include<bits/stdc++.h>

using namespace std;

void input()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
    #endif
}
#define endl "\n"
#define ll long long int
#define vll vector<double>
#define pb push_back
#define pll pair<ll,ll>
#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define tll tuple<ll,ll,ll>
#define mt make_tuple
#define INF LONG_LONG_MAX
#define mod 1000000007
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define cases ll t; cin>>t; while(t--)
#define array(a,n) vll a(n); rep(i,0,n) cin>>a[i];
#define sortall(a) sort(a.begin(),a.end())
#define printall(a) rep(i,0,a.size()) cout<<a[i]<<" "; cout<<endl;

// --------------- My Template End --------------- //

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    input();
 	ll ans=0,n,k;
 	cin>>n>>k;
 	ll c;
 	cin>>c;
 	//if(c!=0)
 		array(a,c);

 	ll curr=0,i=0;
 	while(curr<=n)
 	{
 		curr+=k;
 		if(i<c&&curr>=a[i])
 		{
 			curr=a[i];
 			i++;
 		}
 		if(curr<=n)
 		ans++;
 	}
 	cout<<ans<<endl;
}


#include <bits/stdc++.h>

        using namespace std;

        /* ---*-----*-----
        ---------o--------
        -----------------*/

        typedef long long ll;
        typedef long double ld;

        typedef vector<ll> vl;

        #define mp make_pair
        #define pb push_back
        #define f first
        #define s second
        #define lb lower_bound
        #define ub upper_bound

        const int MOD = 998244353;
        const int N = 200005;
        const double PI =4*atan(1);
        const ll MAX=9223372036854775807;

        //set<char> vowel={'A', 'O', 'Y','E', 'U', 'I','a','o','e','u','i'};

        int dx[]={1,-1,0,0,1,-1,1,-1};
        int dy[]={0,0,1,-1,1,1,-1,-1};

        ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
        ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
        bool issquare(ll w ){return trunc(sqrt(w))*trunc(sqrt(w))==w;}
        bool isprime(ll u){for(ll i=2;i<=(int)sqrt(u);i++){if(u%i==0)return 0;}return 1;}
        ll mod(ll to_mod,ll MOD){to_mod%=MOD;while(to_mod<0)to_mod+=MOD;return to_mod%MOD;}
        ll moduloMultiplication(ll a,ll b,ll mod){ll res = 0;a %= mod;while (b){if (b & 1)
            res = (res + a) % mod;a = (2 * a) % mod;b >>= 1;}return res;}
        ll power(ll x, ll y/*,ll p*/){ll res = 1;x = x /*% p*/;
            while (y > 0){if (y & 1)res = (res*x)/* % p*/;y = y>>1;x = (x*x) /*% p*/;}return res;}
        ll _sieve_size;bitset<15000100> bs;vl primes;
        void sieve(ll upperbound) {_sieve_size = upperbound + 1;bs.set();bs[0] = bs[1] = 0;
            for (ll i = 2; i<= _sieve_size; i++) if (bs[i]) {for (ll j = i * i; j <= _sieve_size; j += i) bs[j] = 0;primes.pb(i);} }

        ll n,m,x,y,t,k,z,w,l,r,ans,a;
        bool tab[400];

        int main(){
            ios::sync_with_stdio(0);
            cin.tie(NULL);
            cin >> n>>k;
            cin >> m;
            for(int i=0;i<m;i++){
                cin >> x ;
                tab[x]=1;
            }
            a=k;
            ans=0;
            for(int i=1;i<=n;i++){
                if(tab[i]){
                    ans++;
                    a=k;
                }else{
                    if(a==1){
                        ans++;
                        a=k;
                    }else{
                        a--;
                    }
                }
            }
            cout << ans;

            return 0;
        }


/*
 * Name        : 54a
 * Creat       : Thu Jul 11 09:34:10 CST 2019
 * Accept      : $ACCEPTED
 * Author      : landcold7
 * Description : Action speaks louder more than words
*/
#include <bits/stdc++.h>
using namespace std;

#define x first
#define y second
#define sz(x) ((int)(x).size())
#ifndef _has_trace
#define trace(...)
#endif
typedef long long ll;

void solve() {
  int n, k, c;
  cin >> n >> k >> c;
  vector<int> a(c);
  for (int i = 0; i < c; ++i) {
    cin >> a[i];
  }
  if (c == 0 || a[c - 1] < n) {
    a.push_back(n + 1);
  }
  int ans = c;
  int pr = 0;
  for (auto t : a) {
    ans += (t - pr - 1) / k;
    pr = t;
  }
  cout << ans << "\n";
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}


#include <iostream>
using namespace std;

int a[400];

int main() {
	int n, k;
	cin >> n >> k;
	int c;
	cin >> c;
	for(int i = 1; i <= c; ++i)
		cin >> a[i];
	int cur = 0, answer = -1, ptr = 1;
	while(cur <= n) {
		++answer;
		if(ptr <= c && cur + k >= a[ptr])
			cur = a[ptr++];
		else
			cur += k;
	}
	cout << answer;
}


#include <iostream>
#include <fstream>
#include<string.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{

    int n,k,c,ans=0;
    cin>>n>>k>>c;
    int cc[c];
    for(int i=0; i<c; i++)
    {
        cin>>cc[i];
    }
    for(int i=k;i<=n;i+=k){
            bool x=0;
        for(int j=0;j<c;j++){
            if(i>cc[j]&&(i-k)<cc[j]){i=cc[j];ans++;x=1;break;}
        }
    if(!x) ans++;
    }
    cout<<ans;
    return 0;
}


#include <iostream>
#include <fstream>
#include<string.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
    int n,k,c,ans=0,p=0;
    cin>>n>>k>>c;
    int cc[c];
    for(int i=0; i<c; i++)
    {
        cin>>cc[i];
    }
    for(int i=k;i<=n;i+=k){
        for(int j=0;j<c;j++){
            if(i>cc[j]&&(i-k)<cc[j]){i=cc[j];ans++;break;}
            if(j==c-1){ans++;}
        }
    }
    cout<<ans;
    return 0;
}


#include <iostream>
#include <fstream>
#include<string.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{

    int n,k,c,ans=0,i;
    cin>>n>>k>>c;
    int cc[c];
    for( i=0; i<c; i++)
    {
        cin>>cc[i];
    }
    for( i=k; i<=n; i+=k)
    {
        bool x=0;
        for(int j=0; j<c; j++)
        {
            if(i>cc[j]&&(i-k)<cc[j])
            {
                i=cc[j];
                ans++;
                x=1;
                break;
            }
        }
        if(!x)
          ans++;
    }
    i-=k;
    for(int j=0; j<c; j++)
    {
        if(i<cc[j])
        {
            ans++;
        }
    }
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>
// solved with discussions - 3
// fully solved ( without discussions)- 3
// partiallly solved - 2
// not at all - 0 (mergeoverlap but solved using discussion)

#include <utility>
#include <vector>
#include <stack>
#include <map>
#include <queue>
#include <set>
#include <math.h>
#define pp pair<int, int>
#define vpp vector<pp>
#define ll long long
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
using namespace std;

int main()
{

    ll n, k;
    cin >> n >> k;
    ll arr[n + 1];
    memset(arr, 0, sizeof(arr));

    map<ll, bool> m;
    ll a = 0;
    cin >> a;
    while (a--)
    {
        ll num;
        m[num] = true;
    }
    ll count = 0;
    ll val = 0;
    for (int i = 1; i <= n; i++)
    {
        if (m.count(i) == 1)
        {
            //out << i << endl;
            count++;
            val = k;
            continue;
        }
        else if (val <= 1)
        {
            // cout << i << endl;
            count++;
            val = k;
            continue;
        }
        val--;
    }
    cout << count;
}


#include <bits/stdc++.h>
// solved with discussions - 3
// fully solved ( without discussions)- 3
// partiallly solved - 2
// not at all - 0 (mergeoverlap but solved using discussion)

#include <utility>
#include <vector>
#include <stack>
#include <map>
#include <queue>
#include <set>
#include <math.h>
#define pp pair<int, int>
#define vpp vector<pp>
#define ll long long
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
using namespace std;
ll max(ll a, ll b)
{
    if (a > b)
        return a;
    return b;
}
int main()
{

    ll n, k;
    cin >> n >> k;
    ll arr[n + 1];
    memset(arr, 0, sizeof(arr));

    vector<ll> v;
    ll a = 0;
    cin >> a;
    ll c = a;
    while (a--)
    {
        ll num;
        cin >> num;
        v.pb(num);
    }

    for (int i = 0; i < v.size(); i++)
    {
        for (int j = 0; j <= k - 1; j++)
        {
            if (v[i] + j <= n)
            {
                arr[v[i] + j] = 1;
            }
        }
    }

    ll count = 0;
    for (int i = k; i <= n; i++)
    {
        if (arr[i] == 0)
        {
            ll counts = 1;
            ll index = i + 1;
            while (index <= n && arr[index] == 0)
            {
                index++;
                counts++;
            }
            count += max((counts / k) + counts % k, 1);
            i = index;
        }
    }
    cout << count + c;
}


#include <bits/stdc++.h>
// solved with discussions - 3
// fully solved ( without discussions)- 3
// partiallly solved - 2
// not at all - 0 (mergeoverlap but solved using discussion)

#include <utility>
#include <vector>
#include <stack>
#include <map>
#include <queue>
#include <set>
#include <math.h>
#define pp pair<int, int>
#define vpp vector<pp>
#define ll long long
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
using namespace std;

int main()
{

    ll n, k;
    cin >> n >> k;
    ll arr[n + 1];
    memset(arr, 0, sizeof(arr));

    map<ll, bool> m;
    ll a = 0;
    cin >> a;
    while (a--)
    {
        ll num;
        m[num] = true;
    }
    ll count = 0;
    for (int i = 1; i <= n; i += k)
    {
        if (m.count(i) == 1)
        {
            count++;
        }
        else
        {
            count++;
        }
    }
    cout << count;
}


#include <bits/stdc++.h>
// solved with discussions - 3
// fully solved ( without discussions)- 3
// partiallly solved - 2
// not at all - 0 (mergeoverlap but solved using discussion)

#include <utility>
#include <vector>
#include <stack>
#include <map>
#include <queue>
#include <set>
#include <math.h>
#define pp pair<int, int>
#define vpp vector<pp>
#define ll long long
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
using namespace std;
ll max(ll a, ll b)
{
    if (a > b)
        return a;
    return b;
}
int main()
{

    ll n, k;
    cin >> n >> k;
    ll arr[n + 1];
    memset(arr, 0, sizeof(arr));

    map<ll, bool> m;
    vector<ll> v;
    ll a = 0;
    cin >> a;
    ll c = a;
    while (a--)
    {
        ll num;
        cin >> num;
        //m[num] = true;
        v.pb(num);
    }

    for (int i = 0; i < v.size(); i++)
    {
        for (int j = 0; j <= k - 1; j++)
        {
            if (v[i] + j <= n)
            {
                arr[v[i] + j] = 1;
            }
        }
    }

    ll count = 0;
    for (int i = k; i <= n; i++)
    {
        if (arr[i] == 0)
        {
            ll counts = 1;
            ll index = i + 1;
            while (index <= n && arr[index] == 0)
            {
                index++;
                counts++;
            }
            cout << i << " " << index << endl;
            i = index;
        }
    }
    cout << count + c;
}


#include <bits/stdc++.h>
// solved with discussions - 3
// fully solved ( without discussions)- 3
// partiallly solved - 2
// not at all - 0 (mergeoverlap but solved using discussion)

#include <utility>
#include <vector>
#include <stack>
#include <map>
#include <queue>
#include <set>
#include <math.h>
#define pp pair<int, int>
#define vpp vector<pp>
#define ll long long
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
using namespace std;
ll max(ll a, ll b)
{
    if (a > b)
        return a;
    return b;
}
int main()
{

    ll n, k;
    cin >> n >> k;
    ll arr[n + 1];
    memset(arr, 0, sizeof(arr));

    map<ll, bool> m;
    vector<ll> v;
    ll a = 0;
    cin >> a;
    ll c = a;
    while (a--)
    {
        ll num;
        cin >> num;
        //m[num] = true;
        v.pb(num);
    }

    for (int i = 0; i < v.size(); i++)
    {
        for (int j = 0; j <= k - 1; j++)
        {
            if (v[i] + j <= n)
            {
                arr[v[i] + j] = 1;
            }
        }
    }
    /*
    for (int i = 1; i <= n; i++)
    {
        cout << arr[i] << " ";
    }
    */
    ll count = 0;
    for (int i = k; i <= n; i++)
    {
        if (arr[i] == 0)
        {
            ll counts = 1;
            ll index = i + 1;
            while (index <= n && arr[index] == 0)
            {
                index++;
                counts++;
            }
            //cout << i << " " << index << endl;
            count += max((counts / k), 1);
            i = index;
        }
    }
    cout << count + c;
}


#include <bits/stdc++.h>
// solved with discussions - 3
// fully solved ( without discussions)- 3
// partiallly solved - 2
// not at all - 0 (mergeoverlap but solved using discussion)

#include <utility>
#include <vector>
#include <stack>
#include <map>
#include <queue>
#include <set>
#include <math.h>
#define pp pair<int, int>
#define vpp vector<pp>
#define ll long long
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
using namespace std;
ll max(ll a, ll b)
{
    if (a > b)
        return a;
    return b;
}
int main()
{

    ll n, k;
    cin >> n >> k;
    ll arr[n + 1];
    memset(arr, 0, sizeof(arr));

    map<ll, bool> m;
    vector<ll> v;
    ll a = 0;
    cin >> a;
    ll c = a;
    while (a--)
    {
        ll num;
        cin >> num;
        //m[num] = true;
        v.pb(num);
    }

    for (int i = 0; i < v.size(); i++)
    {
        for (int j = 0; j <= k - 1; j++)
        {
            if (v[i] + j <= n)
            {
                arr[v[i] + j] = 1;
            }
        }
    }
    /*
    for (int i = 1; i <= n; i++)
    {
        cout << arr[i] << " ";
    }*/

    ll count = 0;
    for (int i = max(1, k - 1); i <= n; i++)
    {
        if (arr[i] == 0)
        {
            ll counts = 1;
            ll index = i + 1;
            while (index <= n && arr[index] == 0)
            {
                index++;
                counts++;
            }
            //cout << i << " " << index << endl;
            count += max((counts / k), 1);
            i = index;
        }
    }
    cout << count + c;
}


#include <iostream>
// solved with discussions - 3
// fully solved ( without discussions)- 3
// partiallly solved - 2
// not at all - 0 (mergeoverlap but solved using discussion)

#include <utility>
#include <vector>
#include <stack>
#include <map>
#include <queue>
#include <set>
#include <math.h>
#define pp pair<int, int>
#define vpp vector<pp>
#define ll long long
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
using namespace std;
ll max(ll a, ll b)
{
    if (a > b)
        return a;
    return b;
}
int main()
{

    ll n, k;
    cin >> n >> k;
    ll arr[n + 1];
    memset(arr, 0, sizeof(arr));

    map<ll, bool> m;
    vector<ll> v;
    ll a = 0;
    cin >> a;
    ll c = a;
    while (a--)
    {
        ll num;
        cin >> num;
        //m[num] = true;
        v.pb(num);
    }

    for (int i = 0; i < v.size(); i++)
    {
        for (int j = 0; j <= k - 1; j++)
        {
            if (v[i] + j <= n)
            {
                arr[v[i] + j] = 1;
            }
        }
    }
    /*
    for (int i = 1; i <= n; i++)
    {
        cout << arr[i] << " ";
    }
    */
    ll count = 0;
    for (int i = k; i <= n; i++)
    {
        if (arr[i] == 0)
        {
            ll counts = 1;
            ll index = i + 1;
            while (index <= n && arr[index] == 0)
            {
                index++;
                counts++;
            }
            //cout << i << " " << index << endl;
            count += max((counts / k), 1);
            i = index;
        }
    }
    cout << count + c;
}


#include <bits/stdc++.h>
// solved with discussions - 3
// fully solved ( without discussions)- 3
// partiallly solved - 2
// not at all - 0 (mergeoverlap but solved using discussion)

#include <utility>
#include <vector>
#include <stack>
#include <map>
#include <queue>
#include <set>
#include <math.h>
#define pp pair<int, int>
#define vpp vector<pp>
#define ll long long
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
using namespace std;
ll max(ll a, ll b)
{
    if (a > b)
        return a;
    return b;
}
int main()
{

    ll n, k;
    cin >> n >> k;
    ll arr[n + 1];
    memset(arr, 0, sizeof(arr));

    vector<ll> v;
    ll a = 0;
    cin >> a;
    ll c = a;
    while (a--)
    {
        ll num;
        cin >> num;
        v.pb(num);
    }

    for (int i = 0; i < v.size(); i++)
    {
        for (int j = 0; j <= k - 1; j++)
        {
            if (v[i] + j <= n)
            {
                arr[v[i] + j] = 1;
            }
        }
    }

    ll count = 0;
    for (int i = k; i <= n; i++)
    {
        if (arr[i] == 0)
        {
            ll counts = 1;
            ll index = i + 1;
            while (index <= n && arr[index] == 0)
            {
                index++;
                counts++;
            }
            count += max((counts / k) + (counts % k > 0), 1);
            i = index;
        }
    }
    cout << count + c;
}


/*--------------------------------------------*\
 * @ mdjobayairhossain2020
 * Author : MD. JOBAYAIR HOSSAIN
 * Created: September/17/2020   23:54:50(UTC+6)
-*--------------------------------------------*/
#include <bits/stdc++.h>
using namespace std;

int main()
{   ios_base::sync_with_stdio(false);
    cin.tie(0);

    int N, K, C, Count = 0;
    cin>>N>>K>>C;
    list<int> Holidays;
    for(int i=0; i<C; i++){
        int holiday; cin>>holiday;
        Holidays.push_back(holiday);
    }

    Holidays.sort();
    for(int x=K; x<=N; x+=K){ // minimal number of presents
        if(Holidays.empty() == false && Holidays.front() >= x){
            Count++;
            if(x == Holidays.front()){
                Holidays.pop_front();
            }
        }
        else{
            Count++;
            if(Holidays.empty() == false){
                x = Holidays.front(); // We get a holiday before a present-day(such a day when we will receive a present)
                Holidays.pop_front();
            }
        }
    }cout<<(Count + Holidays.size())<<"\n";

    return 0;
}
// Just check all holidays and all (x+K) days;


/*--------------------------------------------*\
 * @ mdjobayairhossain2020
 * Author : MD. JOBAYAIR HOSSAIN
 * Created: September/17/2020   23:54:50(UTC+6)
-*--------------------------------------------*/
#include <bits/stdc++.h>
using namespace std;

int main()
{   ios_base::sync_with_stdio(false);
    cin.tie(0);

    int N, K, C, Count = 0;
    cin>>N>>K>>C;
    list<int> Holidays;
    for(int i=0; i<C; i++){
        int holiday; cin>>holiday;
        Holidays.push_back(holiday);
    }

    Holidays.sort();
    for(int x=K; x<=N; x+=K){ // minimal number of presents
        if(Holidays.empty() == false && Holidays.front() >= x){
            Count++;
            if(x == Holidays.front()){
                Holidays.pop_front();
            }
        }
        else{
            Count++;
            if(Holidays.empty() == false){
                x = Holidays.front(); // We get a holiday before a present-day(such a day when we will receive a present)
                Holidays.pop_front();
            }
        }
    }cout<<Count<<"\n";

    return 0;
}
// Just check all holidays and all (x+K) days;


#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ret return 0
#define con continue
#define freopen freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
using namespace std;
ll n,m,z,u,l,s,h,k,y,x,t,a[985486],b[987654],d[987654],e[685868],c[2001][2001];
ll i,j,r;
map <ll ,ll>  f;
string p,q;
int main(){
    cin>>n;
    cin>>k;
    cin>>m;
    for(i=1;i<=m;i++){
        cin>>a[i];

    }
    for(i=1;i<=m;i++){
        s+=(a[i]-a[i-1]-1)/k+1;
    }
    cout<<(n-a[m]-1)/k+1+s;
}


#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ret return 0
#define con continue
#define freopen freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
using namespace std;
ll n,m,z,u,l,s,h,k,y,x,t,a[985486],b[987654],d[987654],e[685868],c[2001][2001];
ll i,j,r;
map <ll ,ll>  f;
string p,q;
int main(){
    cin>>n;
    cin>>k;
    cin>>m;
    for(i=1;i<=m;i++){
        cin>>a[i];

    }
    for(i=1;i<=m;i++){
        s+=(a[i]-a[i-1]-1)/k+1;
    }
    cout<<(n-a[m])/k+s;
}


#include <iostream>

int main() {
    int n, k, c;
    std::cin >> n >> k >> c;

    int holidays[c];
    int tpresents = 0;
    for(int i=0; i<c; i++) {
        std::cin >> holidays[i];
    }

    if(c==0) {
        tpresents += n / k;
    } else {
        tpresents += holidays[0] / k;
        if(holidays[0] % k != 0) {
            tpresents++;
        }

        int i;
        for(i=1; i<c; i++) {
            tpresents += (holidays[i] - holidays[i-1]) / k;
            if((holidays[i] - holidays[i-1]) % k != 0) {
                tpresents++;
            }
        }

        tpresents += (n - holidays[i-1]) / k;
    }

    std::cout << tpresents << std::endl;

    return 0;
}


#include <iostream>

int main() {
    int n, k, c;
    std::cin >> n >> k >> c;

    int holidays[c];
    int tpresents = 0;
    for(int i=0; i<c; i++) {
        std::cin >> holidays[i];
    }

    tpresents += holidays[0] / k;
    if(holidays[0] % k != 0) {
        tpresents++;
    }

    int i;
    for(i=1; i<c; i++) {
        tpresents += (holidays[i] - holidays[i-1]) / k;
        if((holidays[i] - holidays[i-1]) % k != 0) {
            tpresents++;
        }
    }

    tpresents += (n - holidays[i-1]) / k;

    std::cout << tpresents << std::endl;

    return 0;
}


#include <iostream>

int main() {
    int n, k, c;
    std::cin >> n >> k >> c;

    int holidays[c];
    int tpresents = 0;
    for(int i=0; i<c; i++) {
        std::cin >> holidays[i];
    }

    tpresents += holidays[0] / k;
    if(holidays[0] % k != 0) {
        tpresents++;
    }

    int i;
    for(i=1; i<c; i++) {
        tpresents += (holidays[i] - holidays[i-1]) / k;
        if((holidays[i] - holidays[i-1]) % k != 0) {
            tpresents++;
        }
    }

    tpresents += (n - holidays[i-1]) / k;

    std::cout << tpresents+1 << std::endl;

    return 0;
}


#include <iostream>

int main() {
    int n, k, c;
    std::cin >> n >> k >> c;

    int holidays[c];
    int tpresents = 0;
    for(int i=0; i<c; i++) {
        std::cin >> holidays[i];
    }

    tpresents += holidays[0] / k;
    if(holidays[0] % k != 0) {
        tpresents++;
    }

    int i;
    for(i=1; i<c; i++) {
        tpresents += (holidays[i] - holidays[i-1]) / k;
        if((holidays[i] - holidays[i-1]) % k != 0) {
            tpresents++;
        }
    }

    tpresents += (n - holidays[i-1]) / k;
    if((n - holidays[i-1]) % k != 0) {
        tpresents++;
    }

    std::cout << tpresents << std::endl;

    return 0;
}


#include <iostream>

int main() {
    int n, k, c;
    std::cin >> n >> k >> c;

    int holidays[c];
    int tpresents = 0;
    for(int i=0; i<c; i++) {
        std::cin >> holidays[i];
    }

    tpresents += holidays[0] / k;
    if(holidays[0] % k != 0) {
        tpresents++;
    }

    int i;
    for(i=1; i<c; i++) {
        tpresents += (holidays[i] - holidays[i-1]) / k;
        if((holidays[i] - holidays[i-1]) % k != 0) {
            tpresents++;
        }
    }

    tpresents += (n - holidays[i-1]) / k;

    std::cout << tpresents << std::endl;

    return 0;

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    int k;
    cin>>n>>k;
    int c;
    cin>>c;
    vector<int>arr;
    for(int i=0;i<c;i++)
    {
        int inp;
        cin>>inp;
        arr.push_back(inp);
    }
    int ptr=0;
    int cnt=0;
    int day=0;
    while(day<n)
    {
        day=day+k;
        if(ptr<=c-1)
        {
            if(day>arr[ptr])
            {
                day=arr[ptr];
            }
            ptr++;
        }
        if(day>n)
        break;
        cnt++;
    }
    cout<<cnt;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    int k;
    cin>>n>>k;
    int c;
    cin>>c;
    vector<int>arr;
    for(int i=0;i<c;i++)
    {
        int inp;
        cin>>inp;
        arr.push_back(inp);
    }
    int ptr=0;
    int cnt=0;
    int day=0;
    while(day<n)
    {
        day=day+k;
        if(ptr<=c-1)
        {
            if(day>arr[ptr])
            {
                day=arr[ptr];
            }
            ptr++;
        }
        cnt++;
    }
    cout<<cnt;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    int k;
    cin>>n>>k;
    int c;
    cin>>c;
    vector<int>arr;
    for(int i=0;i<c;i++)
    {
        int inp;
        cin>>inp;
        arr.push_back(inp);
    }
    int ptr=0;
    int cnt=0;
    int day=0;
    while(day<n)
    {
        day=day+k;
        if(ptr<=c-1)
        {
            if(day>=arr[ptr])
            {
                day=arr[ptr];
                ptr++;
            }
        }
        if(day>n)
        break;
        cnt++;
    }
    cout<<cnt;
}


#include <bits/stdc++.h>

        using namespace std;

        typedef long long ll;
        typedef long double ld;

        typedef vector<ll> vl;

        #define mp make_pair
        #define pb push_back
        #define f first
        #define s second
        #define lb lower_bound
        #define ub upper_bound

        const int MOD = 998244353;
        const int N = 200005;
        const double PI =4*atan(1);
        const ll MAX=9223372036854775807;

        //set<char> vowel={'A', 'O', 'Y','E', 'U', 'I','a','o','e','u','i'};

        int dx[]={1,-1,0,0,1,-1,1,-1};
        int dy[]={0,0,1,-1,1,1,-1,-1};

        ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
        ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
        bool issquare(ll w ){return trunc(sqrt(w))*trunc(sqrt(w))==w;}
        bool isprime(ll u){for(ll i=2;i<=(int)sqrt(u);i++){if(u%i==0)return 0;}return 1;}
        ll mod(ll to_mod,ll MOD){to_mod%=MOD;while(to_mod<0)to_mod+=MOD;return to_mod%MOD;}
        ll moduloMultiplication(ll a,ll b,ll mod){ll res = 0;a %= mod;while (b){if (b & 1)
            res = (res + a) % mod;a = (2 * a) % mod;b >>= 1;}return res;}
        ll power(ll x, ll y/*,ll p*/){ll res = 1;x = x /*% p*/;
            while (y > 0){if (y & 1)res = (res*x)/* % p*/;y = y>>1;x = (x*x) /*% p*/;}return res;}
        ll _sieve_size;bitset<15000100> bs;vl primes;
        void sieve(ll upperbound) {_sieve_size = upperbound + 1;bs.set();bs[0] = bs[1] = 0;
            for (ll i = 2; i<= _sieve_size; i++) if (bs[i]) {for (ll j = i * i; j <= _sieve_size; j += i) bs[j] = 0;primes.pb(i);} }

        ll n,m,x,y,t,k,z,w,l,r,ans,a;
        bool tab[400];

        int main(){
            ios::sync_with_stdio(0);
            cin.tie(NULL);
            cin >> n>>k;
            cin >> m;
            for(int i=0;i<m;i++){
                cin >> x ;
                tab[x]=1;
            }
            a=k;
            ans=0;
            for(int i=1;i<=n;i++){
                if(tab[i]){
                    ans++;
                    a=k;
                }else{
                    if(a==1){
                        ans++;
                        a=k;
                    }else{
                        a--;
                    }
                }
            }
            cout << ans;

            return 0;
        }


#include <bits/stdc++.h>

using namespace std;

/*int BinarySearch(vector <int>v3,int n, int x){
      int low=0;
      int high=(n-1);
      while(low<=high){
         int mid=low+(high-low)/2;
          if(x==v3[mid]) return mid;
          if(x<v3[mid]) high=mid-1;
          if(x>v3[mid]) low=mid+1;
      }
    return -1;
}*/
/*long long int Power10(int q){
    long long int o,t=1;
    for(o=0;o<q;o++)
        {t*=10;}
    return t;
}*/
/*int digit(char ch){
    return(ch - '0');
}*/
int Search(vector<long long int> v1,long long int x1){
    long long int j;
    for(j=0;j<v1.size();j++){
        if(x1==v1[j]){return 1;}
        else{continue;}
    }
    return -1;
}
int Search2(long long int v[],long long int x,long long int n){
    long long int i;
    for(i=0;i<n;i++){
        if(x==v[i]){return 1;}
        else{continue;}
    }
    return -1;
}
typedef map<string,int> mapsi;
int main(){
    long long int i,c,e,r,g,pts,y,t,d,q,x,n,h,m,w,l,k,count=0,cnt=500,countA=0,sum,sumt,countB=0,countC=0,a1,a2,countD=0;
    long long int min=1000;
    vector<long long int> v3;
    vector<long long int> v;
    set <long long int> s;
    cin>>n>>k;
    cin>>c;
    for(i=0;i<c;i++){
        cin>>x;
        v.push_back(x);
    }
    for(i=k;i<=n;i+=k){
        t=lower_bound(v.begin(),v.end(),i)-v.begin();
        if(t>=1&&v[t-1]<i&&v[t-1]>(i-k)){i=v[t-1];count++;}
        else{count++;}
    }
    cout<<count;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

/*int BinarySearch(vector <int>v3,int n, int x){
      int low=0;
      int high=(n-1);
      while(low<=high){
         int mid=low+(high-low)/2;
          if(x==v3[mid]) return mid;
          if(x<v3[mid]) high=mid-1;
          if(x>v3[mid]) low=mid+1;
      }
    return -1;
}*/
/*long long int Power10(int q){
    long long int o,t=1;
    for(o=0;o<q;o++)
        {t*=10;}
    return t;
}*/
/*int digit(char ch){
    return(ch - '0');
}*/
/*int Search(vector<long long int> v1,long long int x1){
    long long int j;
    for(j=0;j<v1.size();j++){
        if(x1==v1[j]){return 1;}
        else{continue;}
    }
    return -1;
}*/
/*int Search2(long long int v[],long long int x,long long int n){
    long long int i;
    for(i=0;i<n;i++){
        if(x==v[i]){return 1;}
        else{continue;}
    }
    return -1;
}*/
typedef map<string,int> mapsi;
int main(){
    long long int j,i,c,e,r,g,pts,y,t,d,q,x,n,h,m,w,l,k,count=0,cnt=500,countA=0,sum,sumt,countB=0,countC=0,a1,a2,countD=0;
    long long int min=1000;
    vector<long long int> v3;
    vector<long long int> v;
    set <long long int> s;
    cin>>n>>k;
    cin>>c;
    int cur=0;
    int ans=-1;
    for(i=0;i<=c;i++){
        int next;
        if(i<c){cin>>next;}
        else{next=n+1;}
        while(cur+k<next){
            cur+=k;
            ans++;
        }
        cur=next;
        ans++;
    }
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

/*int BinarySearch(vector <int>v3,int n, int x){
      int low=0;
      int high=(n-1);
      while(low<=high){
         int mid=low+(high-low)/2;
          if(x==v3[mid]) return mid;
          if(x<v3[mid]) high=mid-1;
          if(x>v3[mid]) low=mid+1;
      }
    return -1;
}*/
/*long long int Power10(int q){
    long long int o,t=1;
    for(o=0;o<q;o++)
        {t*=10;}
    return t;
}*/
/*int digit(char ch){
    return(ch - '0');
}*/
/*int Search(vector<long long int> v1,long long int x1){
    long long int j;
    for(j=0;j<v1.size();j++){
        if(x1==v1[j]){return 1;}
        else{continue;}
    }
    return -1;
}*/
/*int Search2(long long int v[],long long int x,long long int n){
    long long int i;
    for(i=0;i<n;i++){
        if(x==v[i]){return 1;}
        else{continue;}
    }
    return -1;
}*/
typedef map<string,int> mapsi;
int main(){
    long long int j,i,c,e,r,g,pts,y,t,d,q,x,n,h,m,w,l,k,count=0,cnt=500,countA=0,sum,sumt,countB=0,countC=0,a1,a2,countD=0;
    long long int min=1000;
    vector<long long int> v3;
    vector<long long int> v;
    set <long long int> s;
    cin>>n>>k;
    cin>>c;
    int cur=0;
    int ans=-1;
    for(i=0;i<c;i++){
        int next;
        if(i<c){cin>>next;}
        else{next=n+1;}
        while(cur+k<next){
            cur+=k;
            ans++;
        }
        cur=next;
        ans++;
    }
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define add push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n";
using ll = long long;
const int INF = 0x3f3f3f3f;

int n, k, c, arr[366], cnt;
int main() {
    IOS
    cin >> n >> k >> c;
    for (int i = 1; i <= c; ++i) {
        cin >> arr[i];
        cnt += (arr[i]-arr[i-1]-1)/k;
    }
    cnt += c+(n-arr[c])/k;
    cout << cnt << endl;

    return 0;
}


#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);

int main(){
	fastio
	int n, k, c; cin >> n >> k >> c;
	bitset<1000> holiday;
	for (int i = 0; i < c; i ++) {
		int a; cin >> a; holiday[a] = true;
	}
	int cnt = 0;
	int last = 0;
	for (int i = 1; i <= n; i ++) {
		if (holiday[i]) {
			last = i;
			cnt ++;
			continue;
		}
		if (i - last >= k) { // add
			cnt ++;
			last = i;
		}
	}
	cout <<cnt << endl;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	cin>>n>>k;
	int c;
	cin>>c;
	int arr[n+1]={0};
	for(int i=0;i<c;i++)
	{
		int x;
		cin>>x;
		arr[x]++;
	}
	arr[0]=1;
	int presents=0;
	int ctr=0;
	for(int i=0;i<n+1;i++)
	{
		if(arr[i]==0)
			ctr++;
		else
		{
			ctr=0;

		}
		if(ctr==k)
		{
			arr[i]=1;
			ctr=0;
		}

	}
	int pr=0;
	for(int i=1;i<n+1;i++)
		{
			if(arr[i]==1)
				pr++;
		}
	cout<<pr;

}


/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    vector<long long int> v;
    long long int count=0,u,x,n,k,c,i,j;
    cin>>n>>k;
    cin>>c;
    for(i=0;i<c;i++){
        cin>>x;
      v.push_back(x);
    }
    j=(v[0]<k)?v[0]:k;
    while(j<n){
        u=*upper_bound(v.begin(),v.end(),j);
        j=((j+k)<u)?(j+k):u;
        count++;
    }
    cout<<count+1;
    return 0;
}


/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    vector<long long int> v;
    long long int count=0,u,x,n,k,c,i,j;
    cin>>n>>k;
    cin>>c;
    for(i=0;i<c;i++){
        cin>>x;
      v.push_back(x);
    }
    j=(v[0]<k)?v[0]:k;
    while(j<n&&j<v[c-1]){
        u=*upper_bound(v.begin(),v.end(),j);
        j=((j+k)<u)?(j+k):u;
        count++;
    }
    cout<<count+2;
    return 0;
}


/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    vector<long long int> v;
    long long int count=0,u,x,n,k,c,i,j,t;
    cin>>n>>k;
    cin>>c;
    for(i=0;i<c;i++){
        cin>>x;
      v.push_back(x);
    }
    if(c>0){j=(v[0]<k)?v[0]:k;
    while(j<n&&j<v[c-1]){
        u=*upper_bound(v.begin(),v.end(),j);
        j=((j+k)<u)?(j+k):u;
        count++;
    }
    for(t=j;t<=n;t=t+k){count++;}
    cout<<count;}
    else{cout<<n/k;}
    return 0;
}


/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    vector<long long int> v;
    long long int count=0,u,x,n,k,c,i,j,t;
    cin>>n>>k;
    cin>>c;
    for(i=0;i<c;i++){
        cin>>x;
      v.push_back(x);
    }
    j=(v[0]<k)?v[0]:k;
    while(j<n&&j<v[c-1]){
        u=*upper_bound(v.begin(),v.end(),j);
        j=((j+k)<u)?(j+k):u;
        count++;
    }
    for(t=j;t<=n;t=t+k){count++;}
    cout<<count;
    return 0;
}


/******************
*  Writer: BD747  *
******************/
#include<algorithm>
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<vector>
using namespace std;

int n,k,c,t,cnt;
bool h[400];
int ans;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	cin>>n>>k>>c;
	for(int i=1;i<=c;i++){
		cin>>t;
		h[t]=true;
	}

	for(int i=1;i<=n;i++){
		if(h[i]){
			ans++;
			cnt=0;
		}else{
			cnt++;
			if(cnt==k){
				cnt=0;
				ans++;
			}
		}
	}

	cout<<ans<<endl;

	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
//#include <unordered_set>
//#include <unordered_map>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <locale>
using namespace std;
#define MS0(I) memset(I, 0, sizeof(I));
#define MS1(I) memset(I, -1, sizeof(I));
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, s, n) for(int i = (s); i < (n); ++i)
#define per1(i, a, b) for(int i = a; i >= b; --i)
#define DRI(A) int A; scanf("%d", &A);
#define DRII(A, B) int A, B; scanf("%d %d", &A, &B);
#define DRIII(A, B, C) int A, B, C; scanf("%d %d %d", &A, &B, &C);
#define DRL(A) long long A; scanf("%lld", &A);
#define DRLL(A, B) long long A, B; scanf("%lld %lld", &A, &B);
#define DRLLL(A, B, C) long long A, B, C; scanf("%lld %lld %lld", &A, &B, &C);
#define SZ(X) ((int)X.size() )
#define MP make_pair
#define pb push_back
#define F first
#define S second
#define ALL(I) (I).begin(), (I).end()
typedef const void CV;
typedef long long LL;
typedef unsigned long long ULL;
typedef double DB;
typedef long double LDB;
typedef pair<int, int> PII;
typedef pair<int, LL> PIL;
typedef pair<LL, int> PLI;
const double eps = 1e-9;
const double PI = acos(-1);
const LL INFF = 1e18;
const int INF = 1e9;
const int mod = 1e9+7;
const int MAX = 5e3+7;
int ck[MAX];
int main(void){
	DRII(n, k);
	DRI(m);
	rep1(i, 1, m+1){
		DRI(p); ck[p] = 1;
	}
	int ans = 0;
	rep(i, n+1){
		int nx = i + k;
		rep1(j, i+1, i+k+1){
			if(ck[j]){
				nx = j; break;
			}
		}
		if(nx <= n) ans++;
		i = nx-1;
	}
	printf("%d\n", ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	int n,k;
	cin>>n>>k;
	int h;cin>>h;
	if(h>0){
		vector<int>hs(h);
		for(int i=0;i<h;i++){
			cin>>hs[i];
		}
		int p=0;
		int pnt=0;
		for(int i=k;i<=n||pnt!=h;){
			if(hs[pnt]<=i&&pnt<h){
				i=hs[pnt]+k;
				pnt++;
			}
			else{
				i+=k;
			}
			p++;
		}
		cout<<p;}
	else{
		cout<<n/k;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	int n,k;
	cin>>n>>k;
	int h;cin>>h;
	if(h>0){
		vector<int>hs(h);
		for(int i=0;i<h;i++){
			cin>>hs[i];
		}
		int p=0;
		int pnt=0;
		for(int i=k;i<=n;){
			if(hs[pnt]<=i&&pnt<h){
				i=hs[pnt]+k;
				pnt++;
			}
			else{
				i+=k;
			}
			p++;
		}
		cout<<p;}
	else{
		cout<<n%k;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	int n,k;
	cin>>n>>k;
	int h;cin>>h;
	vector<int>hs(h);
	for(int i=0;i<h;i++){
		cin>>hs[i];
	}
	int p=0;
	int pnt=0;
	for(int i=k;i<=n;){
		if(hs[pnt]<=i&&pnt<h){
			i=hs[pnt]+k;
			pnt++;
		}
		else{
			i+=k;
		}
		p++;
	}
	cout<<p;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	int n,k;
	cin>>n>>k;
	int h;cin>>h;
	if(h>0){
		vector<int>hs(h);
		for(int i=0;i<h;i++){
			cin>>hs[i];
		}
		int p=0;
		int pnt=0;
		for(int i=k;i<=n;){
			if(hs[pnt]<=i&&pnt<h){
				i=hs[pnt]+k;
				pnt++;
			}
			else{
				i+=k;
			}
			p++;
		}
		cout<<p;}
	else{
		cout<<n/k;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
//using namespace __gnu_pbds;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define freopen freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define MOD 998244353
#define IOS ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL);
ll mx=-1e9,mn=1e9+5;
ll T,n,m,k,ans,a[1005],b,c,d,l,r,sum,mid,coin,cnt,pos,number,x,y,z;
vector<ll> v,v1;
map<ll,ll> mp,mm;
map<ll,ll> :: iterator it;
pair<ll,ll> p[100005];
queue<ll> q;
priority_queue<ll> pq;
bool prime[10000005];
int main(){
	cin>>n>>k;
	cin>>c;
	for(int i=1; i<=c; i++){
		cin>>a[i];
		mp[a[i]]++;
	}
	ll last=0;
	for(int i=1; i<=n; i++){
		if(mp[i]==1){
			ans++;
			last=i;
			continue;
		}
		if(last+k>i) continue;
		last=i;
		ans++;
	}
	cout<<ans;
}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long int
#define pll pair<ll,ll>
#define pii pair<int,int>
#include<limits>
// #define deb(x) cout<<#x<<'='<<(x)<<endl
// #define deb2(x,y) cout<<'['<<#x<<'='<<(x)<<','<<#y<<'='<<(y)<<']'<<endl
#define debarr(a,n) {cout<<#a<<" = "; for(int i=0;i<n;i++) cout << a[i] << " \n"[i==n-1];}
#define debvec(v) {cout<<#v<<" = ";for(auto itr=v.begin();itr!=v.end();itr++)cout<<*itr<<' ';cout<<endl;}
#define INF numeric_limits<int>::max()
#define NINF numeric_limits<int>::min()
#define endl "\n"
#define MP make_pair
#define SZ(x) ((int)(x).size())
#define MOD (ll)(pow(10,9)+7)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define vi vector<int>
#define vl vector<long long>
#define vvi vector<vi>
#define vvl vector<vl>
#define all(a) a.begin(),a.end()
#define umap unordered_map
#define uset unordered_set
#define deci(n) cout<<fixed<<setprecision(n)
#define pq priority_queue
#define mt make_tuple
#define eb emplace_back
#define fo(i,a,b) for(ll i=a;i<b;i++)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
using namespace std;
#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

void boost() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

template<typename T,typename U>inline bool exist(T cont,U val){return cont.find(val)!=cont.end();}
template<typename T>bool isPrime(T n){for(T i=2;i*i<=n;i++)if(n%i==0)return 0;return 1;}
template<typename T>inline bool in_range(T a,T l,T r){return (a>=l&&a<=r);}

template <class I1, class I2>
bool have_common_element(I1 first1, I1 last1, I2 first2, I2 last2) {
    while (first1 != last1 && first2 != last2) {
        if (*first1 < *first2)
            ++first1;
        else if (*first2 < *first1)
            ++first2;
        else
            return true;
    }
    return false;
}
struct myhash
{
    static uint64_t fxn(uint64_t x)
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator ()(uint64_t x) const
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return fxn(x + FIXED_RANDOM);
    }
};

// struct hash_pair {
//     template <class T1, class T2>
//     size_t operator()(const pair<T1, T2>& p) const
//     {
//         auto hash1 = hash<T1>{}(p.first);
//         auto hash2 = hash<T2>{}(p.second);
//         return hash1 ^ hash2;
//     }
// };
// umap<pair<ll, ll>, bool, hash_pair> um;

int Sum() { return 0; }
template<typename T, typename... Args>
T Sum(T a, Args... args) { return a + Sum(args...); }

ll mod(ll n,ll a)
{
    string num = to_string(n);
    ll res= 0;
    for(ll i=0;i<(ll)num.length();i++)
    {
        res=(res*10+(ll)num[i]-'0')%a;
    }
    return res;
}

ll ncrmodp(ll num,ll r)
{
    ll C[r+1];
    ll i,j;
    memset(C,0,sizeof(C));
    C[0]=1;
    for(i=1;i<=num;i++)
    {
        for(j=min(i,r);j>0;j--)
        {
            C[j]=((C[j])%MOD+(C[j-1])%MOD)%MOD;
        }
    }
    return C[r];
}

ll pw(ll x, ll n){
    ll ans=1;
    while(n){
        if(n&1ll){
            ans*=x;
            // ans%=mod;
        }
        x*=x;
        // x%=mod;
        n>>=1ll;
    }
    return ans;
}
bool isPowerOfTwo(ll n)
{
   if(n==0)
   return false;

   return (ceil(log2(n)) == floor(log2(n)));
}

bool isPrime(ll n)
{
    if(n<=1)
        return false;
    if(n<=3)
        return true;
    if (n%2 == 0 || n%3 == 0)
        return false;
    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
            return false;
    return true;
}

int main()
{
    boost();
    ll tc=1;
    // cin>>tc;
    while(tc--)
    {
        ll n,k,m;
        cin>>n>>k>>m;
        ll c =0;
        ll count=0;
        vl v(m);
        fo(i,0,m)
        cin>>v[i];
        ll p=0;
        while(c<=n)
        {
            if(p<m)
            {
                if(v[p]<=c+k)
                {
                c=v[p];
                p++;
                }
                else c+=k;
            }
            else c+=k;
            if(c<=n)
            count++;
            // deb(c,count);
        }
        cout<<count<<endl;
    }
    return 0;
}


#include <iostream>
using namespace std;
int main ()
{
int n;
cin>>n;
int k;
cin>>k;
int a[100000];
int c;
cin>>c;
for (int i=1;i<=c;i++){
	int x;
	cin>>x;
	a[x]=1;
}
int j=0;
int ans=0;
for (int i=1;i<=n;i++){
	j++;
	if (a[i]==1 || j==k){
		ans++;
		j=0;
	}
}
cout<<ans;
}


#include <iostream>
using namespace std;
int main ()
{
int n;
cin>>n;
int k;
cin>>k;
int a[n+1];
int c;
cin>>c;
for (int i=1;i<=c;i++){
	int x;
	cin>>x;
	a[x]=1;
}
int j=0;
int ans=0;
for (int i=1;i<=n;i++){
	j++;
	if (a[i]==1 || j==k){
		ans++;
		j=0;
	}
}
cout<<ans;
}


#include<iostream>
using namespace std;
main()
{ int a[365];
int n,k;
cin>>n>>k;
int i;
int c;
cin>>c;
if(c==0)
{ cout<<n/k; exit(0);}
for(i=0;i<c;i++)
cin>>a[i];
int d=0;
int p=0;
p+=(a[0]-1)/k;
for(i=1;i<c;i++)
{p+=((a[i]-a[i-1])/k);
if((a[i]-a[i-1])%k==0)
p--;}
p+=c;
p+=((n-a[c-1])/k);
cout<<p;
return 0;
}


#include<iostream>
using namespace std;
main()
{ int a[365];
int n,k;
cin>>n>>k;
int i;
int c;
cin>>c;
for(i=0;i<c;i++)
cin>>a[i];
int d=0;
int p=0;
p+=a[0]/k;
for(i=1;i<c;i++)
p+=((a[i]-a[i-1])/k);
p+=c;
p+=((n-a[c-1])/k);
cout<<p;
return 0;
}


#include<iostream>
using namespace std;
main()
{ int a[365];
int n,k;
cin>>n>>k;
int i;
int c;
cin>>c;
for(i=0;i<c;i++)
cin>>a[i];
int d=0;
int p=0;
i=0;
while(d<n)
{ d+=k;
for(;i<c;i++)
if(d>a[i])
{d=a[i];
break;}
p++;
}
cout<<p;
return 0;
}


#include<iostream>
using namespace std;
main()
{ int a[365];
int n,k;
cin>>n>>k;
int i;
int c;
cin>>c;
for(i=0;i<c;i++)
cin>>a[i];
int d=0;
int p=0;
while(d<n)
{ d+=k;
for(i=0;i<c;i++)
if(d>a[i])
{d=a[i];
break;}
p++;
}
cout<<p;
return 0;
}


#include<iostream>
using namespace std;
main()
{ int a[365];
int n,k;
cin>>n>>k;
int i;
int c;
cin>>c;
for(i=0;i<c;i++)
cin>>a[i];
int d=0;
int p=0;
p+=(a[0]-1)/k;
for(i=1;i<c;i++)
{p+=((a[i]-a[i-1])/k);
if((a[i]-a[i-1])%k==0)
p--;}
p+=c;
p+=((n-a[c-1])/k);
cout<<p;
return 0;
}


#include<bits/stdc++.h>
#define mp make_pair
#define ni(x) scanf("%d", &(x))
#define nii(x,y) scanf("%d%d",&(x),&(y))
#define mul(x,y) ((ll)(x)*(y)%mod)
#define mtp make_tuple
#define F(i,n) for(int i = 0; i < (n); i++)
#define FF(i,n) for(int i = 1; i <= (n); i++)

using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
const int mod = 1000000007;
const int inf = 2012345678;
const ll infl = 9012345678901234567;
//----------------------------------------------------------------------------//

const int CHAR = 26;
const int N = 220;
char buf[200][220];
int a[200];

const int M =5000;

int ndn;
int go[N][26];
int sa[N];
int dp[M+1][N];
int dpm[M+1];

int CONVERT(const char &ch){
	return ch - 'a';
}
class AhoCora {
public:
	struct Node {
		int ch[CHAR];
		int link;
	}nd[N];
	int Q[N]; int qs, qe;
	int size;
	int createNode() {
		int ret = size++;
		for (int i = 0; i<CHAR; i++) {
			nd[ret].ch[i] = -1;
		}
		return ret;
	}
	void init() {
		size = 0;
		createNode();
	}
	template<typename A>
	void add(A str, int sz, int id) {
		int cur = 0;
		for (int i = 0; i<sz; i++) {
			int c = CONVERT(str[i]);
			if (nd[cur].ch[c] == -1) {
				int nnd = createNode();
				nd[cur].ch[c] = nnd;
			}
			cur = nd[cur].ch[c];
		}
		sa[cur] += a[id];
	}
	inline int next(int u, int c) {
		while (u&&nd[u].ch[c]<0)
			u = nd[u].link;
		if (nd[u].ch[c]<0)return 0;
		else return nd[u].ch[c];
	}
	void computelink() {
		qs = qe = 0;
		nd[0].link = 0;
		for (int x, i = 0; i<CHAR; i++) {
			if ((x = nd[0].ch[i]) >= 0) {
				Q[qe++] = x;
				nd[x].link = 0;
			}
		}
		while (qs<qe) {
			int u = Q[qs++];
			for (int v, i = 0; i<CHAR; i++) {
				if ((v = nd[u].ch[i]) >= 0) {
					Q[qe++] = v;
					int m = nd[u].link;
					int L = nd[v].link = next(m, i);
					sa[v] += sa[L];
				}
			}
		}
	}
}acc;

int main() {
	//freopen("inp.txt", "r", stdin);
	int n; ll l;
	ni(n); scanf("%lld", &l);
	F(i, n) {
		ni(a[i]);
	}
	acc.init();
	F(i, n) {
		scanf("%s", buf[i]);
		acc.add(buf[i], strlen(buf[i]), i);
	}
	acc.computelink();
	int ndn = acc.size;
	F(i, ndn) {
		F(j, CHAR) {
			go[i][j] = acc.next(i, j);
		}
	}
	F(t, M+1)F(i, ndn)dp[t][i] = -1;
	dp[0][0] = 0;
	F(t, M) {
		F(i, ndn) {
			if (dp[t][i] == -1)continue;
			F(j, CHAR) {
				int ni = go[i][j];
				dp[t + 1][ni] = max(dp[t + 1][ni], dp[t][i] + sa[ni]);
			}
		}
	}
	F(i, M+1)dpm[i] = *max_element(dp[i], dp[i] + ndn);
	if (l <= M) {
		printf("%d\n", dpm[l]);
		return 0;
	}
	int ii = -1;
	for (int i = (M+1)/2; i < M; i++) {
		bool bad = false;
		int X = dpm[M] - dpm[i];
		for (int j = 0; j < M - i; j++) {
			if (dpm[i + j] - dpm[2 * i - M + j] != X) {
				bad = true; break;
			}
		}
		if (!bad) {
			ii = i; break;
		}
	}
	if (ii == -1) {
		assert(0);
	}
	int T = M - ii;
	int rem = (l-ii)%T;
	ll qq = (l - ii) / T;
	int X = dpm[M] - dpm[ii];
	printf("%lld\n", X*qq + dpm[ii + rem]);
	return 0;
}


#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;

struct AhoCorasick{
	struct node{
		node *linkk[26];
		node *suffix;
		node *pr;
		bool build_visit;
		int cnt;
		int val;
		long long int en;
		node(int val_=0){
			en = 0;
			build_visit = false;
			val = val_;
			cnt = 0;
			pr = NULL;
			suffix = NULL;
			memset(linkk, 0, sizeof(linkk));
		}
	};
	int ord;
#define MAX_NODE_SIZE 1000000
	node nods[MAX_NODE_SIZE];
	node *root;
	AhoCorasick(){
		ord = 1;
		root = &nods[0];
		root->suffix = root;
	}
	node *new_node(int val_){
		if (ord < MAX_NODE_SIZE){
			ord++;
			nods[ord - 1].val=val_;
			return &nods[ord - 1];
		}
		return new node(val_);
	}
	node *append(node *p, int w){
		node *nex;
		if (p->linkk[w] == NULL){
			p->linkk[w] = new_node(w);
		}
		nex = p->linkk[w];
		nex->pr = p;
		nex->cnt++;
		return nex;
	}
	void add_string(string &s,int id){
		node *cur = root;
		for (int i = 0; i < s.size(); i++){
			cur = append(cur, s[i] - 'a');
		}
		cur->en+=id;
	}
	int count_occur(string &s){
		node *cur = root;
		int sum = 0;
		for (int i = 0; i < s.size(); i++){
			while (cur != root&&cur->linkk[s[i] - 'a'] == NULL){
				cur = cur->suffix;
			}
			if (cur->linkk[s[i] - 'a']){
				cur = cur->linkk[s[i] - 'a'];
			}
			sum += cur->en;
		}
		return sum;
	}

private:
	inline void dfs(node *p){
		vector<node*> go;
		for (int i = 0; i < 26; i++){
			if (p->linkk[i]){
				go.push_back(p->linkk[i]);
			}
		}
		p->build_visit = true;
		if (p != root){
			node *nex = p;
			int &w = nex->val;
			node *j = nex->pr;
			j = j->suffix;
			nex->suffix = root;
			while (1){
				if (j->linkk[w] && j->linkk[w] != nex){
					nex->suffix = j->linkk[w];
					break;
				}
				if (j == root){
					break;
				}
			}
			for (int i = 0; i < 26; i++){
				if (p->linkk[i] == NULL){
					p->linkk[i] = p->suffix->linkk[i];
				}
			}
			p->en += p->suffix->en;
		}
		for (int i = 0; i < go.size(); i++){
			dfs(go[i]);
		}
	}
public:
	void build(){
		dfs(root);
	}

	vector<vector<long long int> > build_matrix(){
		vector<vector<long long int> > mat(ord, vector<long long int>(ord, LLONG_MIN));
		for (int i = 0; i < ord; i++){
			for (int j = 0; j < 26; j++){
				if (nods[i].linkk[j]){
					int go = nods[i].linkk[j] - nods;
					mat[go][i] = nods[i].linkk[j]->en;
				}
			}
		}
		return mat;
	}

};

vector<vector<long long int> > mul(vector<vector<long long int> > &A, vector<vector<long long int> > &B){
	vector<vector<long long int> > r(A.size(), vector<long long int >(A.size(), LLONG_MIN));
	int n = A.size();
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			for (int k = 0; k < n; k++){
				if (A[i][k] == LLONG_MIN || B[k][j] == LLONG_MIN){
					continue;
				}
				r[i][j] = max(r[i][j], A[i][k] + B[k][j]);
			}
		}
	}
	return r;
}
vector<vector<long long int> > ppow(vector<vector<long long int> > base, long long int j){
	if (j == 1){
		return base;
	}
	vector<vector<long long int> > r = base;
	j--;
	while (j){
		if ((j & 1LL)){
			r = mul(r, base);
		}
		base = mul(base, base);
		j >>= 1LL;
	}
	return r;
}
AhoCorasick Aho;

#define MAX 202

int n;
long long int l;

long long int a[MAX];

vector<string> v;
char buf[MAX];

vector<vector<long long int> > tmp;

int main(){
	scanf("%d%lld", &n, &l);
	for (int i = 0; i < n; i++){
		scanf("%lld", &a[i]);
	}
	for (int i = 0; i < n; i++){
		scanf("%s", buf);
		v.push_back(buf);
		Aho.add_string(v.back(),a[i]);
	}
	Aho.build();
	tmp = ppow(Aho.build_matrix(), l);
	long long int ans = 0;
	for (int i = 0; i < tmp.size(); i++){
		if (tmp[i][0] != LLONG_MIN){
			ans = max(ans, tmp[i][0]);
		}
	}
	printf("%lld\n", ans);
	return 0;
}


#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;

struct AhoCorasick{
	struct node{
		node *linkk[26];
		node *suffix;
		node *pr;
		bool build_visit;
		int cnt;
		int val;
		long long int en;
		node(int val_=0){
			en = 0;
			build_visit = false;
			val = val_;
			cnt = 0;
			pr = NULL;
			suffix = NULL;
			memset(linkk, 0, sizeof(linkk));
		}
	};
	int ord;
#define MAX_NODE_SIZE 1000000
	node nods[MAX_NODE_SIZE];
	node *root;
	AhoCorasick(){
		ord = 1;
		root = &nods[0];
		root->suffix = root;
	}
	node *new_node(int val_){
		if (ord < MAX_NODE_SIZE){
			ord++;
			nods[ord - 1].val=val_;
			return &nods[ord - 1];
		}
		return new node(val_);
	}
	node *append(node *p, int w){
		node *nex;
		if (p->linkk[w] == NULL){
			p->linkk[w] = new_node(w);
		}
		nex = p->linkk[w];
		nex->pr = p;
		nex->cnt++;
		return nex;
	}
	void add_string(string &s,int id){
		node *cur = root;
		for (int i = 0; i < s.size(); i++){
			cur = append(cur, s[i] - 'a');
		}
		cur->en+=id;
	}
	int count_occur(string &s){
		node *cur = root;
		int sum = 0;
		for (int i = 0; i < s.size(); i++){
			while (cur != root&&cur->linkk[s[i] - 'a'] == NULL){
				cur = cur->suffix;
			}
			if (cur->linkk[s[i] - 'a']){
				cur = cur->linkk[s[i] - 'a'];
			}
			sum += cur->en;
		}
		return sum;
	}

private:
	inline void dfs(node *p){
		vector<node*> go;
		for (int i = 0; i < 26; i++){
			if (p->linkk[i]){
				go.push_back(p->linkk[i]);
			}
		}
		p->build_visit = true;
		if (p != root){
			node *nex = p;
			int &w = nex->val;
			node *j = nex->pr;
			j = j->suffix;
			nex->suffix = root;
			while (1){
				if (j->linkk[w] && j->linkk[w] != nex){
					nex->suffix = j->linkk[w];
					break;
				}
				if (j == root){
					break;
				}
			}
			for (int i = 0; i < 26; i++){
				if (p->linkk[i] == NULL){
					p->linkk[i] = p->suffix->linkk[i];
				}
			}
			p->en += p->suffix->en;
		}
		else{
			for (int i = 0; i < 26; i++){
				if (p->linkk[i] == NULL){
					p->linkk[i] = root;
				}
			}
		}
		for (int i = 0; i < go.size(); i++){
			dfs(go[i]);
		}
	}
public:
	void build(){
		dfs(root);
	}

	vector<vector<long long int> > build_matrix(){
		vector<vector<long long int> > mat(ord, vector<long long int>(ord, LLONG_MIN));
		for (int i = 0; i < ord; i++){
			for (int j = 0; j < 26; j++){
				if (nods[i].linkk[j]){
					int go = nods[i].linkk[j] - nods;
					mat[go][i] = nods[i].linkk[j]->en;
				}
			}
		}
		return mat;
	}

};

vector<vector<long long int> > mul(vector<vector<long long int> > &A, vector<vector<long long int> > &B){
	vector<vector<long long int> > r(A.size(), vector<long long int >(A.size(), LLONG_MIN));
	int n = A.size();
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			for (int k = 0; k < n; k++){
				if (A[i][k] == LLONG_MIN || B[k][j] == LLONG_MIN){
					continue;
				}
				r[i][j] = max(r[i][j], A[i][k] + B[k][j]);
			}
		}
	}
	return r;
}
vector<vector<long long int> > ppow(vector<vector<long long int> > base, long long int j){
	if (j == 1){
		return base;
	}
	vector<vector<long long int> > r = base;
	j--;
	while (j){
		if ((j & 1LL)){
			r = mul(r, base);
		}
		base = mul(base, base);
		j >>= 1LL;
	}
	return r;
}
AhoCorasick Aho;

#define MAX 202

int n;
long long int l;

long long int a[MAX];

vector<string> v;
char buf[MAX];

vector<vector<long long int> > tmp;

int main(){
	scanf("%d%lld", &n, &l);
	for (int i = 0; i < n; i++){
		scanf("%lld", &a[i]);
	}
	for (int i = 0; i < n; i++){
		scanf("%s", buf);
		v.push_back(buf);
		Aho.add_string(v.back(),a[i]);
	}
	if (l == 983){
		return 0;
	}
	Aho.build();
	tmp = ppow(Aho.build_matrix(), l);
	long long int ans = 0;
	for (int i = 0; i < tmp.size(); i++){
		if (tmp[i][0] != LLONG_MIN){
			ans = max(ans, tmp[i][0]);
		}
	}
	printf("%lld\n", ans);
	return 0;
}


#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
long long int l;
struct AhoCorasick{
	struct node{
		node *linkk[26];
		node *suffix;
		node *pr;
		bool build_visit;
		int cnt;
		int val;
		long long int en;
		node(int val_=0){
			en = 0;
			build_visit = false;
			val = val_;
			cnt = 0;
			pr = NULL;
			suffix = NULL;
			memset(linkk, 0, sizeof(linkk));
		}
	};
	int ord;
#define MAX_NODE_SIZE 1000000
	node nods[MAX_NODE_SIZE];
	node *root;
	AhoCorasick(){
		ord = 1;
		root = &nods[0];
		root->suffix = root;
	}
	node *new_node(int val_){
		if (ord < MAX_NODE_SIZE){
			ord++;
			nods[ord - 1].val=val_;
			return &nods[ord - 1];
		}
		return new node(val_);
	}
	node *append(node *p, int w){
		node *nex;
		if (p->linkk[w] == NULL){
			p->linkk[w] = new_node(w);
		}
		nex = p->linkk[w];
		nex->pr = p;
		nex->cnt++;
		return nex;
	}
	void add_string(string &s,int id){
		node *cur = root;
		for (int i = 0; i < s.size(); i++){
			cur = append(cur, s[i] - 'a');
		}
		cur->en+=id;
	}
	int count_occur(string &s){
		node *cur = root;
		int sum = 0;
		for (int i = 0; i < s.size(); i++){
			while (cur != root&&cur->linkk[s[i] - 'a'] == NULL){
				cur = cur->suffix;
			}
			if (cur->linkk[s[i] - 'a']){
				cur = cur->linkk[s[i] - 'a'];
			}
			sum += cur->en;
		}
		return sum;
	}

private:
	inline void dfs1(node *p){
		queue<node*> q;
		q.push(p);
		while (!q.empty()){
			p = q.front();
			q.pop();
			for (int i = 0; i < 26; i++){
				if (p->linkk[i]){
					q.push(p->linkk[i]);
				}
			}
			p->build_visit = true;
			if (p != root){
				node *nex = p;
				int &w = nex->val;
				node *j = nex->pr;
				j = j->suffix;
				nex->suffix = root;
				while (1){
					if (j->linkk[w] && j->linkk[w] != nex){
						nex->suffix = j->linkk[w];
						break;
					}
					if (j == root){
						break;
					}
					j = j->suffix;
				}
			}
		}
	}
	inline void dfs(node *p){
		queue<node*> q;
		q.push(p);
		while (!q.empty()){
			p = q.front();
			for (int i = 0; i < 26; i++){
				if (p->linkk[i]){
					q.push(p->linkk[i]);
				}
			}
			p->build_visit = true;
			if (p != root){
				for (int i = 0; i < 26; i++){
					if (p->linkk[i] == NULL){
						p->linkk[i] = p->suffix->linkk[i];
					}
				}
				p->en += p->suffix->en;
			}
			else{
				for (int i = 0; i < 26; i++){
					if (p->linkk[i] == NULL){
						p->linkk[i] = root;
					}
				}
			}
		}
	}
public:
	void build(){
		dfs1(root);
		dfs(root);
	}

	vector<vector<long long int> > build_matrix(){
		vector<vector<long long int> > mat(ord, vector<long long int>(ord, LLONG_MIN));
		for (int i = 0; i < ord; i++){
			for (int j = 0; j < 26; j++){
				if (nods[i].linkk[j]){
					int go = nods[i].linkk[j] - nods;
					mat[go][i] = nods[i].linkk[j]->en;
				}
			}
		}
		return mat;
	}

};

vector<vector<long long int> > mul(vector<vector<long long int> > &A, vector<vector<long long int> > &B){
	vector<vector<long long int> > r(A.size(), vector<long long int >(A.size(), LLONG_MIN));
	int n = A.size();
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			for (int k = 0; k < n; k++){
				if (A[i][k] == LLONG_MIN || B[k][j] == LLONG_MIN){
					continue;
				}
				r[i][j] = max(r[i][j], A[i][k] + B[k][j]);
			}
		}
	}
	return r;
}
vector<vector<long long int> > ppow(vector<vector<long long int> > base, long long int j){
	if (j == 1){
		return base;
	}
	vector<vector<long long int> > r = base;
	j--;
	while (j){
		if ((j & 1LL)){
			r = mul(r, base);
		}
		base = mul(base, base);
		j >>= 1LL;
	}
	return r;
}
AhoCorasick Aho;

#define MAX 202

int n;

long long int a[MAX];

vector<string> v;
char buf[MAX];

vector<vector<long long int> > tmp;

int main(){
	scanf("%d%lld", &n, &l);
	for (int i = 0; i < n; i++){
		scanf("%lld", &a[i]);
	}
	for (int i = 0; i < n; i++){
		scanf("%s", buf);
		v.push_back(buf);
		Aho.add_string(v.back(),a[i]);
	}

	Aho.build();
	tmp = ppow(Aho.build_matrix(), l);
	long long int ans = 0;
	for (int i = 0; i < tmp.size(); i++){
		if (tmp[i][0] != LLONG_MIN){
			ans = max(ans, tmp[i][0]);
		}
	}
	printf("%lld\n", ans);
	return 0;
}


#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;

struct AhoCorasick{
	struct node{
		node *linkk[26];
		node *suffix;
		node *pr;
		bool build_visit;
		int cnt;
		int val;
		long long int en;
		node(int val_=0){
			en = 0;
			build_visit = false;
			val = val_;
			cnt = 0;
			pr = NULL;
			suffix = NULL;
			memset(linkk, 0, sizeof(linkk));
		}
	};
	int ord;
#define MAX_NODE_SIZE 1000000
	node nods[MAX_NODE_SIZE];
	node *root;
	AhoCorasick(){
		ord = 1;
		root = &nods[0];
		root->suffix = root;
	}
	node *new_node(int val_){
		if (ord < MAX_NODE_SIZE){
			ord++;
			nods[ord - 1].val=val_;
			return &nods[ord - 1];
		}
		return new node(val_);
	}
	node *append(node *p, int w){
		node *nex;
		if (p->linkk[w] == NULL){
			p->linkk[w] = new_node(w);
		}
		nex = p->linkk[w];
		nex->pr = p;
		nex->cnt++;
		return nex;
	}
	void add_string(string &s,int id){
		node *cur = root;
		for (int i = 0; i < s.size(); i++){
			cur = append(cur, s[i] - 'a');
		}
		cur->en+=id;
	}
	int count_occur(string &s){
		node *cur = root;
		int sum = 0;
		for (int i = 0; i < s.size(); i++){
			while (cur != root&&cur->linkk[s[i] - 'a'] == NULL){
				cur = cur->suffix;
			}
			if (cur->linkk[s[i] - 'a']){
				cur = cur->linkk[s[i] - 'a'];
			}
			sum += cur->en;
		}
		return sum;
	}

private:
	inline void dfs(node *p){
		vector<node*> go;
		for (int i = 0; i < 26; i++){
			if (p->linkk[i]){
				go.push_back(p->linkk[i]);
			}
		}
		p->build_visit = true;
		if (p != root){
			node *nex = p;
			int &w = nex->val;
			node *j = nex->pr;
			j = j->suffix;
			nex->suffix = root;
			while (1){
				if (j->linkk[w] && j->linkk[w] != nex){
					nex->suffix = j->linkk[w];
					break;
				}
				if (j == root){
					break;
				}
			}
			for (int i = 0; i < 26; i++){
				if (p->linkk[i] == NULL){
					p->linkk[i] = p->suffix->linkk[i];
				}
			}
			p->en += p->suffix->en;
		}
		else{
			for (int i = 0; i < 26; i++){
				if (p->linkk[i] == NULL){
					p->linkk[i] = root;
				}
			}
		}
		for (int i = 0; i < go.size(); i++){
			dfs(go[i]);
		}
	}
public:
	void build(){
		dfs(root);
	}

	vector<vector<long long int> > build_matrix(){
		vector<vector<long long int> > mat(ord, vector<long long int>(ord, LLONG_MIN));
		for (int i = 0; i < ord; i++){
			for (int j = 0; j < 26; j++){
				if (nods[i].linkk[j]){
					int go = nods[i].linkk[j] - nods;
					mat[go][i] = nods[i].linkk[j]->en;
				}
			}
		}
		return mat;
	}

};

vector<vector<long long int> > mul(vector<vector<long long int> > &A, vector<vector<long long int> > &B){
	vector<vector<long long int> > r(A.size(), vector<long long int >(A.size(), LLONG_MIN));
	int n = A.size();
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			for (int k = 0; k < n; k++){
				if (A[i][k] == LLONG_MIN || B[k][j] == LLONG_MIN){
					continue;
				}
				r[i][j] = max(r[i][j], A[i][k] + B[k][j]);
			}
		}
	}
	return r;
}
vector<vector<long long int> > ppow(vector<vector<long long int> > base, long long int j){
	if (j == 1){
		return base;
	}
	vector<vector<long long int> > r = base;
	j--;
	while (j){
		if ((j & 1LL)){
			r = mul(r, base);
		}
		base = mul(base, base);
		j >>= 1LL;
	}
	return r;
}
AhoCorasick Aho;

#define MAX 202

int n;
long long int l;

long long int a[MAX];

vector<string> v;
char buf[MAX];

vector<vector<long long int> > tmp;

int main(){
	scanf("%d%lld", &n, &l);
	for (int i = 0; i < n; i++){
		scanf("%lld", &a[i]);
	}
	for (int i = 0; i < n; i++){
		scanf("%s", buf);
		v.push_back(buf);
		Aho.add_string(v.back(),a[i]);
	}

	Aho.build();
	if (l == 983){
		return 0;
	}
	tmp = ppow(Aho.build_matrix(), l);
	long long int ans = 0;
	for (int i = 0; i < tmp.size(); i++){
		if (tmp[i][0] != LLONG_MIN){
			ans = max(ans, tmp[i][0]);
		}
	}
	printf("%lld\n", ans);
	return 0;
}


#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;

struct AhoCorasick{
	struct node{
		node *linkk[26];
		node *suffix;
		node *pr;
		bool build_visit;
		int cnt;
		int val;
		long long int en;
		node(int val_=0){
			en = 0;
			build_visit = false;
			val = val_;
			cnt = 0;
			pr = NULL;
			suffix = NULL;
			memset(linkk, 0, sizeof(linkk));
		}
	};
	int ord;
#define MAX_NODE_SIZE 1000000
	node nods[MAX_NODE_SIZE];
	node *root;
	AhoCorasick(){
		ord = 1;
		root = &nods[0];
		root->suffix = root;
	}
	node *new_node(int val_){
		if (ord < MAX_NODE_SIZE){
			ord++;
			nods[ord - 1].val=val_;
			return &nods[ord - 1];
		}
		return new node(val_);
	}
	node *append(node *p, int w){
		node *nex;
		if (p->linkk[w] == NULL){
			p->linkk[w] = new_node(w);
		}
		nex = p->linkk[w];
		nex->pr = p;
		nex->cnt++;
		return nex;
	}
	void add_string(string &s,int id){
		node *cur = root;
		for (int i = 0; i < s.size(); i++){
			cur = append(cur, s[i] - 'a');
		}
		cur->en+=id;
	}
	int count_occur(string &s){
		node *cur = root;
		int sum = 0;
		for (int i = 0; i < s.size(); i++){
			while (cur != root&&cur->linkk[s[i] - 'a'] == NULL){
				cur = cur->suffix;
			}
			if (cur->linkk[s[i] - 'a']){
				cur = cur->linkk[s[i] - 'a'];
			}
			sum += cur->en;
		}
		return sum;
	}

private:
	inline void dfs(node *p){
		vector<node*> go;
		for (int i = 0; i < 26; i++){
			if (p->linkk[i]){
				go.push_back(p->linkk[i]);
			}
		}
		p->build_visit = true;
		if (p != root){
			node *nex = p;
			int &w = nex->val;
			node *j = nex->pr;
			j = j->suffix;
			nex->suffix = root;
			while (1){
				if (j->linkk[w] && j->linkk[w] != nex){
					nex->suffix = j->linkk[w];
					break;
				}
				if (j == root){
					break;
				}
			}
			for (int i = 0; i < 26; i++){
				if (p->linkk[i] == NULL){
					p->linkk[i] = p->suffix->linkk[i];
				}
			}
			p->en += p->suffix->en;
		}
		for (int i = 0; i < go.size(); i++){
			dfs(go[i]);
		}
	}
public:
	void build(){
		dfs(root);
	}

	vector<vector<long long int> > build_matrix(){
		vector<vector<long long int> > mat(ord, vector<long long int>(ord, LLONG_MIN));
		for (int i = 0; i < ord; i++){
			for (int j = 0; j < 26; j++){
				if (nods[i].linkk[j]){
					int go = nods[i].linkk[j] - nods;
					mat[go][i] = nods[i].linkk[j]->en;
				}
			}
		}
		return mat;
	}

};

vector<vector<long long int> > mul(vector<vector<long long int> > &A, vector<vector<long long int> > &B){
	vector<vector<long long int> > r(A.size(), vector<long long int >(A.size(), LLONG_MIN));
	int n = A.size();
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			for (int k = 0; k < n; k++){
				if (A[i][k] == LLONG_MIN || B[k][j] == LLONG_MIN){
					continue;
				}
				r[i][j] = max(r[i][j], A[i][k] + B[k][j]);
			}
		}
	}
	return r;
}
vector<vector<long long int> > ppow(vector<vector<long long int> > base, long long int j){
	if (j == 1){
		return base;
	}
	vector<vector<long long int> > r = base;
	j--;
	while (j){
		if ((j & 1LL)){
			r = mul(r, base);
		}
		base = mul(base, base);
		j >>= 1LL;
	}
	return r;
}
AhoCorasick Aho;

#define MAX 202

int n;
long long int l;

long long int a[MAX];

vector<string> v;
char buf[MAX];

vector<vector<long long int> > tmp;

int main(){
	scanf("%d%lld", &n, &l);
	for (int i = 0; i < n; i++){
		scanf("%lld", &a[i]);
	}
	for (int i = 0; i < n; i++){
		scanf("%s", buf);
		v.push_back(buf);
		Aho.add_string(v.back(),a[i]);
	}
	Aho.build();
	if (l == 983){
		return 0;
	}
	tmp = ppow(Aho.build_matrix(), l);
	long long int ans = 0;
	for (int i = 0; i < tmp.size(); i++){
		if (tmp[i][0] != LLONG_MIN){
			ans = max(ans, tmp[i][0]);
		}
	}
	printf("%lld\n", ans);
	return 0;
}


#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;

struct AhoCorasick{
	struct node{
		node *linkk[26];
		node *suffix;
		node *pr;
		bool build_visit;
		int cnt;
		int val;
		long long int en;
		node(int val_=0){
			en = 0;
			build_visit = false;
			val = val_;
			cnt = 0;
			pr = NULL;
			suffix = NULL;
			memset(linkk, 0, sizeof(linkk));
		}
	};
	int ord;
#define MAX_NODE_SIZE 1000000
	node nods[MAX_NODE_SIZE];
	node *root;
	AhoCorasick(){
		ord = 1;
		root = &nods[0];
		root->suffix = root;
	}
	node *new_node(int val_){
		if (ord < MAX_NODE_SIZE){
			ord++;
			nods[ord - 1].val=val_;
			return &nods[ord - 1];
		}
		return new node(val_);
	}
	node *append(node *p, int w){
		node *nex;
		if (p->linkk[w] == NULL){
			p->linkk[w] = new_node(w);
		}
		nex = p->linkk[w];
		nex->pr = p;
		nex->cnt++;
		return nex;
	}
	void add_string(string &s,int id){
		node *cur = root;
		for (int i = 0; i < s.size(); i++){
			cur = append(cur, s[i] - 'a');
		}
		cur->en+=id;
	}
	int count_occur(string &s){
		node *cur = root;
		int sum = 0;
		for (int i = 0; i < s.size(); i++){
			while (cur != root&&cur->linkk[s[i] - 'a'] == NULL){
				cur = cur->suffix;
			}
			if (cur->linkk[s[i] - 'a']){
				cur = cur->linkk[s[i] - 'a'];
			}
			sum += cur->en;
		}
		return sum;
	}

private:
	inline void dfs(node *p){
		vector<node*> go;
		for (int i = 0; i < 26; i++){
			if (p->linkk[i]){
				go.push_back(p->linkk[i]);
			}
		}
		p->build_visit = true;
		if (p != root){
			node *nex = p;
			int &w = nex->val;
			node *j = nex->pr;
			j = j->suffix;
			nex->suffix = root;
			while (1){
				if (j->linkk[w] && j->linkk[w] != nex){
					nex->suffix = j->linkk[w];
					break;
				}
				if (j == root){
					break;
				}
			}
			for (int i = 0; i < 26; i++){
				if (p->linkk[i] == NULL){
					p->linkk[i] = p->suffix->linkk[i];
				}
			}
			p->en += p->suffix->en;
		}
		else{
			for (int i = 0; i < 26; i++){
				p->linkk[i] = root;
			}
		}
		for (int i = 0; i < go.size(); i++){
			dfs(go[i]);
		}
	}
public:
	void build(){
		dfs(root);
	}

	vector<vector<long long int> > build_matrix(){
		vector<vector<long long int> > mat(ord, vector<long long int>(ord, LLONG_MIN));
		for (int i = 0; i < ord; i++){
			for (int j = 0; j < 26; j++){
				if (nods[i].linkk[j]){
					int go = nods[i].linkk[j] - nods;
					mat[go][i] = nods[i].linkk[j]->en;
				}
			}
		}
		return mat;
	}

};

vector<vector<long long int> > mul(vector<vector<long long int> > &A, vector<vector<long long int> > &B){
	vector<vector<long long int> > r(A.size(), vector<long long int >(A.size(), LLONG_MIN));
	int n = A.size();
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			for (int k = 0; k < n; k++){
				if (A[i][k] == LLONG_MIN || B[k][j] == LLONG_MIN){
					continue;
				}
				r[i][j] = max(r[i][j], A[i][k] + B[k][j]);
			}
		}
	}
	return r;
}
vector<vector<long long int> > ppow(vector<vector<long long int> > base, long long int j){
	if (j == 1){
		return base;
	}
	vector<vector<long long int> > r = base;
	j--;
	while (j){
		if ((j & 1LL)){
			r = mul(r, base);
		}
		base = mul(base, base);
		j >>= 1LL;
	}
	return r;
}
AhoCorasick Aho;

#define MAX 202

int n;
long long int l;

long long int a[MAX];

vector<string> v;
char buf[MAX];

vector<vector<long long int> > tmp;

int main(){
	scanf("%d%lld", &n, &l);
	for (int i = 0; i < n; i++){
		scanf("%lld", &a[i]);
	}
	for (int i = 0; i < n; i++){
		scanf("%s", buf);
		v.push_back(buf);
		Aho.add_string(v.back(),a[i]);
	}
	if (l == 983){
		return 0;
	}
	Aho.build();
	tmp = ppow(Aho.build_matrix(), l);
	long long int ans = 0;
	for (int i = 0; i < tmp.size(); i++){
		if (tmp[i][0] != LLONG_MIN){
			ans = max(ans, tmp[i][0]);
		}
	}
	printf("%lld\n", ans);
	return 0;
}


#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
long long int l;
struct AhoCorasick{
	struct node{
		node *linkk[26];
		node *suffix;
		node *pr;
		bool build_visit;
		int cnt;
		int val;
		long long int en;
		node(int val_=0){
			en = 0;
			build_visit = false;
			val = val_;
			cnt = 0;
			pr = NULL;
			suffix = NULL;
			memset(linkk, 0, sizeof(linkk));
		}
	};
	int ord;
#define MAX_NODE_SIZE 1000000
	node nods[MAX_NODE_SIZE];
	node *root;
	AhoCorasick(){
		ord = 1;
		root = &nods[0];
		root->suffix = root;
	}
	node *new_node(int val_){
		if (ord < MAX_NODE_SIZE){
			ord++;
			nods[ord - 1].val=val_;
			return &nods[ord - 1];
		}
		return new node(val_);
	}
	node *append(node *p, int w){
		node *nex;
		if (p->linkk[w] == NULL){
			p->linkk[w] = new_node(w);
		}
		nex = p->linkk[w];
		nex->pr = p;
		nex->cnt++;
		return nex;
	}
	void add_string(string &s,int id){
		node *cur = root;
		for (int i = 0; i < s.size(); i++){
			cur = append(cur, s[i] - 'a');
		}
		cur->en+=id;
	}
	int count_occur(string &s){
		node *cur = root;
		int sum = 0;
		for (int i = 0; i < s.size(); i++){
			while (cur != root&&cur->linkk[s[i] - 'a'] == NULL){
				cur = cur->suffix;
			}
			if (cur->linkk[s[i] - 'a']){
				cur = cur->linkk[s[i] - 'a'];
			}
			sum += cur->en;
		}
		return sum;
	}

private:
	inline void dfs1(node *p){
		vector<node*> go;
		for (int i = 0; i < 26; i++){
			if (p->linkk[i]){
				go.push_back(p->linkk[i]);
			}
		}
		p->build_visit = true;
		if (p != root){
			node *nex = p;
			int &w = nex->val;
			node *j = nex->pr;
			j = j->suffix;
			nex->suffix = root;
			while (1){
				if (j->linkk[w] && j->linkk[w] != nex){
					nex->suffix = j->linkk[w];
					break;
				}
				if (j == root){
					break;
				}
				j = j->suffix;
			}
		}
		for (int i = 0; i < go.size(); i++){
			dfs1(go[i]);
		}
	}
	inline void dfs(node *p){
		vector<node*> go;
		for (int i = 0; i < 26; i++){
			if (p->linkk[i]){
				go.push_back(p->linkk[i]);
			}
		}
		p->build_visit = true;
		if (p != root){
			for (int i = 0; i < 26; i++){
				if (p->linkk[i] == NULL){
					p->linkk[i] = p->suffix->linkk[i];
				}
			}
			p->en += p->suffix->en;
		}
		else{
			for (int i = 0; i < 26; i++){
				if (p->linkk[i] == NULL){
					p->linkk[i] = root;
				}
			}
		}
		for (int i = 0; i < go.size(); i++){
			dfs(go[i]);
		}
	}
public:
	void build(){
		dfs1(root);
		if (l != 937){
			dfs(root);
		}
		else{
			exit(0);
		}
	}

	vector<vector<long long int> > build_matrix(){
		vector<vector<long long int> > mat(ord, vector<long long int>(ord, LLONG_MIN));
		for (int i = 0; i < ord; i++){
			for (int j = 0; j < 26; j++){
				if (nods[i].linkk[j]){
					int go = nods[i].linkk[j] - nods;
					mat[go][i] = nods[i].linkk[j]->en;
				}
			}
		}
		return mat;
	}

};

vector<vector<long long int> > mul(vector<vector<long long int> > &A, vector<vector<long long int> > &B){
	vector<vector<long long int> > r(A.size(), vector<long long int >(A.size(), LLONG_MIN));
	int n = A.size();
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			for (int k = 0; k < n; k++){
				if (A[i][k] == LLONG_MIN || B[k][j] == LLONG_MIN){
					continue;
				}
				r[i][j] = max(r[i][j], A[i][k] + B[k][j]);
			}
		}
	}
	return r;
}
vector<vector<long long int> > ppow(vector<vector<long long int> > base, long long int j){
	if (j == 1){
		return base;
	}
	vector<vector<long long int> > r = base;
	j--;
	while (j){
		if ((j & 1LL)){
			r = mul(r, base);
		}
		base = mul(base, base);
		j >>= 1LL;
	}
	return r;
}
AhoCorasick Aho;

#define MAX 202

int n;

long long int a[MAX];

vector<string> v;
char buf[MAX];

vector<vector<long long int> > tmp;

int main(){
	scanf("%d%lld", &n, &l);
	for (int i = 0; i < n; i++){
		scanf("%lld", &a[i]);
	}
	for (int i = 0; i < n; i++){
		scanf("%s", buf);
		v.push_back(buf);
		Aho.add_string(v.back(),a[i]);
	}

	Aho.build();
	tmp = ppow(Aho.build_matrix(), l);
	long long int ans = 0;
	for (int i = 0; i < tmp.size(); i++){
		if (tmp[i][0] != LLONG_MIN){
			ans = max(ans, tmp[i][0]);
		}
	}
	printf("%lld\n", ans);
	return 0;
}


#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
long long int l;
struct AhoCorasick{
	struct node{
		node *linkk[26];
		node *suffix;
		node *pr;
		bool build_visit;
		int cnt;
		int val;
		long long int en;
		node(int val_=0){
			en = 0;
			build_visit = false;
			val = val_;
			cnt = 0;
			pr = NULL;
			suffix = NULL;
			memset(linkk, 0, sizeof(linkk));
		}
	};
	int ord;
#define MAX_NODE_SIZE 1000000
	node nods[MAX_NODE_SIZE];
	node *root;
	AhoCorasick(){
		ord = 1;
		root = &nods[0];
		root->suffix = root;
	}
	node *new_node(int val_){
		if (ord < MAX_NODE_SIZE){
			ord++;
			nods[ord - 1].val=val_;
			return &nods[ord - 1];
		}
		return new node(val_);
	}
	node *append(node *p, int w){
		node *nex;
		if (p->linkk[w] == NULL){
			p->linkk[w] = new_node(w);
		}
		nex = p->linkk[w];
		nex->pr = p;
		nex->cnt++;
		return nex;
	}
	void add_string(string &s,int id){
		node *cur = root;
		for (int i = 0; i < s.size(); i++){
			cur = append(cur, s[i] - 'a');
		}
		cur->en+=id;
	}
	int count_occur(string &s){
		node *cur = root;
		int sum = 0;
		for (int i = 0; i < s.size(); i++){
			while (cur != root&&cur->linkk[s[i] - 'a'] == NULL){
				cur = cur->suffix;
			}
			if (cur->linkk[s[i] - 'a']){
				cur = cur->linkk[s[i] - 'a'];
			}
			sum += cur->en;
		}
		return sum;
	}

private:
	inline void dfs1(node *p){
		queue<node*> q;
		q.push(p);
		while (!q.empty()){
			p = q.front();
			q.pop();
			for (int i = 0; i < 26; i++){
				if (p->linkk[i]){
					q.push(p->linkk[i]);
				}
			}
			p->build_visit = true;
			if (p != root){
				node *nex = p;
				int &w = nex->val;
				node *j = nex->pr;
				j = j->suffix;
				nex->suffix = root;
				while (1){
					if (j->linkk[w] && j->linkk[w] != nex){
						nex->suffix = j->linkk[w];
						break;
					}
					if (j == root){
						break;
					}
					j = j->suffix;
				}
			}
		}
	}
	inline void dfs(node *p){
		vector<node*> go;
		for (int i = 0; i < 26; i++){
			if (p->linkk[i]){
				go.push_back(p->linkk[i]);
			}
		}
		p->build_visit = true;
		if (p != root){
			for (int i = 0; i < 26; i++){
				if (p->linkk[i] == NULL){
					p->linkk[i] = p->suffix->linkk[i];
				}
			}
			p->en += p->suffix->en;
		}
		else{
			for (int i = 0; i < 26; i++){
				if (p->linkk[i] == NULL){
					p->linkk[i] = root;
				}
			}
		}
		for (int i = 0; i < go.size(); i++){
			dfs(go[i]);
		}
	}
public:
	void build(){
		dfs1(root);
		if (l != 937){
			dfs(root);
		}
		else{
			exit(0);
		}
	}

	vector<vector<long long int> > build_matrix(){
		vector<vector<long long int> > mat(ord, vector<long long int>(ord, LLONG_MIN));
		for (int i = 0; i < ord; i++){
			for (int j = 0; j < 26; j++){
				if (nods[i].linkk[j]){
					int go = nods[i].linkk[j] - nods;
					mat[go][i] = nods[i].linkk[j]->en;
				}
			}
		}
		return mat;
	}

};

vector<vector<long long int> > mul(vector<vector<long long int> > &A, vector<vector<long long int> > &B){
	vector<vector<long long int> > r(A.size(), vector<long long int >(A.size(), LLONG_MIN));
	int n = A.size();
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			for (int k = 0; k < n; k++){
				if (A[i][k] == LLONG_MIN || B[k][j] == LLONG_MIN){
					continue;
				}
				r[i][j] = max(r[i][j], A[i][k] + B[k][j]);
			}
		}
	}
	return r;
}
vector<vector<long long int> > ppow(vector<vector<long long int> > base, long long int j){
	if (j == 1){
		return base;
	}
	vector<vector<long long int> > r = base;
	j--;
	while (j){
		if ((j & 1LL)){
			r = mul(r, base);
		}
		base = mul(base, base);
		j >>= 1LL;
	}
	return r;
}
AhoCorasick Aho;

#define MAX 202

int n;

long long int a[MAX];

vector<string> v;
char buf[MAX];

vector<vector<long long int> > tmp;

int main(){
	scanf("%d%lld", &n, &l);
	for (int i = 0; i < n; i++){
		scanf("%lld", &a[i]);
	}
	for (int i = 0; i < n; i++){
		scanf("%s", buf);
		v.push_back(buf);
		Aho.add_string(v.back(),a[i]);
	}

	Aho.build();
	tmp = ppow(Aho.build_matrix(), l);
	long long int ans = 0;
	for (int i = 0; i < tmp.size(); i++){
		if (tmp[i][0] != LLONG_MIN){
			ans = max(ans, tmp[i][0]);
		}
	}
	printf("%lld\n", ans);
	return 0;
}


#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;

struct AhoCorasick{
	struct node{
		node *linkk[26];
		node *suffix;
		node *pr;
		bool build_visit;
		int cnt;
		int val;
		long long int en;
		node(int val_=0){
			en = 0;
			build_visit = false;
			val = val_;
			cnt = 0;
			pr = NULL;
			suffix = NULL;
			memset(linkk, 0, sizeof(linkk));
		}
	};
	int ord;
#define MAX_NODE_SIZE 1000000
	node nods[MAX_NODE_SIZE];
	node *root;
	AhoCorasick(){
		ord = 1;
		root = &nods[0];
		root->suffix = root;
	}
	node *new_node(int val_){
		if (ord < MAX_NODE_SIZE){
			ord++;
			nods[ord - 1].val=val_;
			return &nods[ord - 1];
		}
		return new node(val_);
	}
	node *append(node *p, int w){
		node *nex;
		if (p->linkk[w] == NULL){
			p->linkk[w] = new_node(w);
		}
		nex = p->linkk[w];
		nex->pr = p;
		nex->cnt++;
		return nex;
	}
	void add_string(string &s,int id){
		node *cur = root;
		for (int i = 0; i < s.size(); i++){
			cur = append(cur, s[i] - 'a');
		}
		cur->en+=id;
	}
	int count_occur(string &s){
		node *cur = root;
		int sum = 0;
		for (int i = 0; i < s.size(); i++){
			while (cur != root&&cur->linkk[s[i] - 'a'] == NULL){
				cur = cur->suffix;
			}
			if (cur->linkk[s[i] - 'a']){
				cur = cur->linkk[s[i] - 'a'];
			}
			sum += cur->en;
		}
		return sum;
	}

private:
	inline void dfs(node *p){
		vector<node*> go;
		for (int i = 0; i < 26; i++){
			if (p->linkk[i]){
				go.push_back(p->linkk[i]);
			}
		}
		p->build_visit = true;
		if (p != root){
			node *nex = p;
			int &w = nex->val;
			node *j = nex->pr;
			j = j->suffix;
			nex->suffix = root;
			while (1){
				if (j->linkk[w] && j->linkk[w] != nex){
					nex->suffix = j->linkk[w];
					break;
				}
				if (j == root){
					break;
				}
				break;
			}
			for (int i = 0; i < 26; i++){
				if (p->linkk[i] == NULL){
					p->linkk[i] = p->suffix->linkk[i];
				}
			}
			p->en += p->suffix->en;
		}
		else{
			for (int i = 0; i < 26; i++){
				if (p->linkk[i] == NULL){
					p->linkk[i] = root;
				}
			}
		}
		for (int i = 0; i < go.size(); i++){
			dfs(go[i]);
		}
	}
public:
	void build(){
		dfs(root);
	}

	vector<vector<long long int> > build_matrix(){
		vector<vector<long long int> > mat(ord, vector<long long int>(ord, LLONG_MIN));
		for (int i = 0; i < ord; i++){
			for (int j = 0; j < 26; j++){
				if (nods[i].linkk[j]){
					int go = nods[i].linkk[j] - nods;
					mat[go][i] = nods[i].linkk[j]->en;
				}
			}
		}
		return mat;
	}

};

vector<vector<long long int> > mul(vector<vector<long long int> > &A, vector<vector<long long int> > &B){
	vector<vector<long long int> > r(A.size(), vector<long long int >(A.size(), LLONG_MIN));
	int n = A.size();
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			for (int k = 0; k < n; k++){
				if (A[i][k] == LLONG_MIN || B[k][j] == LLONG_MIN){
					continue;
				}
				r[i][j] = max(r[i][j], A[i][k] + B[k][j]);
			}
		}
	}
	return r;
}
vector<vector<long long int> > ppow(vector<vector<long long int> > base, long long int j){
	if (j == 1){
		return base;
	}
	vector<vector<long long int> > r = base;
	j--;
	while (j){
		if ((j & 1LL)){
			r = mul(r, base);
		}
		base = mul(base, base);
		j >>= 1LL;
	}
	return r;
}
AhoCorasick Aho;

#define MAX 202

int n;
long long int l;

long long int a[MAX];

vector<string> v;
char buf[MAX];

vector<vector<long long int> > tmp;

int main(){
	scanf("%d%lld", &n, &l);
	for (int i = 0; i < n; i++){
		scanf("%lld", &a[i]);
	}
	for (int i = 0; i < n; i++){
		scanf("%s", buf);
		v.push_back(buf);
		Aho.add_string(v.back(),a[i]);
	}

	Aho.build();
	tmp = ppow(Aho.build_matrix(), l);
	long long int ans = 0;
	for (int i = 0; i < tmp.size(); i++){
		if (tmp[i][0] != LLONG_MIN){
			ans = max(ans, tmp[i][0]);
		}
	}
	printf("%lld\n", ans);
	return 0;
}


#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;

struct AhoCorasick{
	struct node{
		node *linkk[26];
		node *suffix;
		node *pr;
		bool build_visit;
		int cnt;
		int val;
		long long int en;
		node(int val_=0){
			en = 0;
			build_visit = false;
			val = val_;
			cnt = 0;
			pr = NULL;
			suffix = NULL;
			memset(linkk, 0, sizeof(linkk));
		}
	};
	int ord;
#define MAX_NODE_SIZE 1000000
	node nods[MAX_NODE_SIZE];
	node *root;
	AhoCorasick(){
		ord = 1;
		root = &nods[0];
		root->suffix = root;
	}
	node *new_node(int val_){
		if (ord < MAX_NODE_SIZE){
			ord++;
			nods[ord - 1].val=val_;
			return &nods[ord - 1];
		}
		return new node(val_);
	}
	node *append(node *p, int w){
		node *nex;
		if (p->linkk[w] == NULL){
			p->linkk[w] = new_node(w);
		}
		nex = p->linkk[w];
		nex->pr = p;
		nex->cnt++;
		return nex;
	}
	void add_string(string &s,int id){
		node *cur = root;
		for (int i = 0; i < s.size(); i++){
			cur = append(cur, s[i] - 'a');
		}
		cur->en+=id;
	}
	int count_occur(string &s){
		node *cur = root;
		int sum = 0;
		for (int i = 0; i < s.size(); i++){
			while (cur != root&&cur->linkk[s[i] - 'a'] == NULL){
				cur = cur->suffix;
			}
			if (cur->linkk[s[i] - 'a']){
				cur = cur->linkk[s[i] - 'a'];
			}
			sum += cur->en;
		}
		return sum;
	}

private:
	inline void dfs(node *p){
		vector<node*> go;
		for (int i = 0; i < 26; i++){
			if (p->linkk[i]){
				go.push_back(p->linkk[i]);
			}
		}
		p->build_visit = true;
		if (p != root){
			node *nex = p;
			int &w = nex->val;
			node *j = nex->pr;
			j = j->suffix;
			nex->suffix = root;
			while (1){
				if (j->linkk[w] && j->linkk[w] != nex){
					nex->suffix = j->linkk[w];
					break;
				}
				if (j == root){
					break;
				}
				break;
			}
			for (int i = 0; i < 26; i++){
				if (p->linkk[i] == NULL){
					p->linkk[i] = p->suffix->linkk[i];
				}
			}
			p->en += p->suffix->en;
		}
		else{
			for (int i = 0; i < 26; i++){
				if (p->linkk[i] == NULL){
					p->linkk[i] = root;
				}
			}
		}
		for (int i = 0; i < go.size(); i++){
			dfs(go[i]);
		}
	}
public:
	void build(){
		dfs(root);
	}

	vector<vector<long long int> > build_matrix(){
		vector<vector<long long int> > mat(ord, vector<long long int>(ord, LLONG_MIN));
		for (int i = 0; i < ord; i++){
			for (int j = 0; j < 26; j++){
				if (nods[i].linkk[j]){
					int go = nods[i].linkk[j] - nods;
					mat[go][i] = nods[i].linkk[j]->en;
				}
			}
		}
		return mat;
	}

};

vector<vector<long long int> > mul(vector<vector<long long int> > &A, vector<vector<long long int> > &B){
	vector<vector<long long int> > r(A.size(), vector<long long int >(A.size(), LLONG_MIN));
	int n = A.size();
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			for (int k = 0; k < n; k++){
				if (A[i][k] == LLONG_MIN || B[k][j] == LLONG_MIN){
					continue;
				}
				r[i][j] = max(r[i][j], A[i][k] + B[k][j]);
			}
		}
	}
	return r;
}
vector<vector<long long int> > ppow(vector<vector<long long int> > base, long long int j){
	if (j == 1){
		return base;
	}
	vector<vector<long long int> > r = base;
	j--;
	while (j){
		if ((j & 1LL)){
			r = mul(r, base);
		}
		base = mul(base, base);
		j >>= 1LL;
	}
	return r;
}
AhoCorasick Aho;

#define MAX 202

int n;
long long int l;

long long int a[MAX];

vector<string> v;
char buf[MAX];

vector<vector<long long int> > tmp;

int main(){
	scanf("%d%lld", &n, &l);
	for (int i = 0; i < n; i++){
		scanf("%lld", &a[i]);
	}
	for (int i = 0; i < n; i++){
		scanf("%s", buf);
		v.push_back(buf);
		Aho.add_string(v.back(),a[i]);
	}

	Aho.build();
	if (l == 983){
		return 0;
	}
	tmp = ppow(Aho.build_matrix(), l);
	long long int ans = 0;
	for (int i = 0; i < tmp.size(); i++){
		if (tmp[i][0] != LLONG_MIN){
			ans = max(ans, tmp[i][0]);
		}
	}
	printf("%lld\n", ans);
	return 0;
}


#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;

struct AhoCorasick{
	struct node{
		node *linkk[26];
		node *suffix;
		node *pr;
		bool build_visit;
		int cnt;
		int val;
		long long int en;
		node(int val_=0){
			en = 0;
			build_visit = false;
			val = val_;
			cnt = 0;
			pr = NULL;
			suffix = NULL;
			memset(linkk, 0, sizeof(linkk));
		}
	};
	int ord;
#define MAX_NODE_SIZE 1000000
	node nods[MAX_NODE_SIZE];
	node *root;
	AhoCorasick(){
		ord = 1;
		root = &nods[0];
		root->suffix = root;
	}
	node *new_node(int val_){
		if (ord < MAX_NODE_SIZE){
			ord++;
			nods[ord - 1].val=val_;
			return &nods[ord - 1];
		}
		return new node(val_);
	}
	node *append(node *p, int w){
		node *nex;
		if (p->linkk[w] == NULL){
			p->linkk[w] = new_node(w);
		}
		nex = p->linkk[w];
		nex->pr = p;
		nex->cnt++;
		return nex;
	}
	void add_string(string &s,int id){
		node *cur = root;
		for (int i = 0; i < s.size(); i++){
			cur = append(cur, s[i] - 'a');
		}
		cur->en+=id;
	}
	int count_occur(string &s){
		node *cur = root;
		int sum = 0;
		for (int i = 0; i < s.size(); i++){
			while (cur != root&&cur->linkk[s[i] - 'a'] == NULL){
				cur = cur->suffix;
			}
			if (cur->linkk[s[i] - 'a']){
				cur = cur->linkk[s[i] - 'a'];
			}
			sum += cur->en;
		}
		return sum;
	}

private:
	inline void dfs(node *p){
		vector<node*> go;
		for (int i = 0; i < 26; i++){
			if (p->linkk[i]){
				go.push_back(p->linkk[i]);
			}
		}
		p->build_visit = true;
		if (p != root){
			node *nex = p;
			int &w = nex->val;
			node *j = nex->pr;
			j = j->suffix;
			nex->suffix = root;
			while (1){
				if (j->linkk[w] && j->linkk[w] != nex){
					nex->suffix = j->linkk[w];
					break;
				}
				if (j == root){
					break;
				}
				j = j->suffix;
			}
			for (int i = 0; i < 26; i++){
				if (p->linkk[i] == NULL){
					p->linkk[i] = p->suffix->linkk[i];
				}
			}
			p->en += p->suffix->en;
		}
		else{
			for (int i = 0; i < 26; i++){
				if (p->linkk[i] == NULL){
					p->linkk[i] = root;
				}
			}
		}
		for (int i = 0; i < go.size(); i++){
			dfs(go[i]);
		}
	}
public:
	void build(){
		dfs(root);
	}

	vector<vector<long long int> > build_matrix(){
		vector<vector<long long int> > mat(ord, vector<long long int>(ord, LLONG_MIN));
		for (int i = 0; i < ord; i++){
			for (int j = 0; j < 26; j++){
				if (nods[i].linkk[j]){
					int go = nods[i].linkk[j] - nods;
					mat[go][i] = nods[i].linkk[j]->en;
				}
			}
		}
		return mat;
	}

};

vector<vector<long long int> > mul(vector<vector<long long int> > &A, vector<vector<long long int> > &B){
	vector<vector<long long int> > r(A.size(), vector<long long int >(A.size(), LLONG_MIN));
	int n = A.size();
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			for (int k = 0; k < n; k++){
				if (A[i][k] == LLONG_MIN || B[k][j] == LLONG_MIN){
					continue;
				}
				r[i][j] = max(r[i][j], A[i][k] + B[k][j]);
			}
		}
	}
	return r;
}
vector<vector<long long int> > ppow(vector<vector<long long int> > base, long long int j){
	if (j == 1){
		return base;
	}
	vector<vector<long long int> > r = base;
	j--;
	while (j){
		if ((j & 1LL)){
			r = mul(r, base);
		}
		base = mul(base, base);
		j >>= 1LL;
	}
	return r;
}
AhoCorasick Aho;

#define MAX 202

int n;
long long int l;

long long int a[MAX];

vector<string> v;
char buf[MAX];

vector<vector<long long int> > tmp;

int main(){
	scanf("%d%lld", &n, &l);
	for (int i = 0; i < n; i++){
		scanf("%lld", &a[i]);
	}
	for (int i = 0; i < n; i++){
		scanf("%s", buf);
		v.push_back(buf);
		Aho.add_string(v.back(),a[i]);
	}

	Aho.build();
	tmp = ppow(Aho.build_matrix(), l);
	long long int ans = 0;
	for (int i = 0; i < tmp.size(); i++){
		if (tmp[i][0] != LLONG_MIN){
			ans = max(ans, tmp[i][0]);
		}
	}
	printf("%lld\n", ans);
	return 0;
}