#include <bits/stdc++.h>
using namespace std;
long long n, k;
long long S[1000000] = {};
int main() {
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    string s;
    cin >> s;
    S[s.size()]++;
  }
  string s;
  cin >> s;
  long long pass = s.size();
  long long sum1 = 1, sum2 = 0;
  for (long long i = 0; i < pass; i++) {
    sum1 += S[i];
    sum2 += S[i];
  }
  sum2 += S[pass];
  cout << sum1 + ((sum1 - 1) / k) * 5 << " " << sum2 + ((sum2 - 1) / k) * 5
       << endl;
  return 0;
}
