#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i, l, sum = 0, sum1 = 0, y;
  string s;
  cin >> n >> k;
  if (n == 1)
    cout << "1 1" << endl;
  else {
    vector<string> v(n);
    map<int, int> m;
    for (i = 0; i < n; i++) {
      cin >> v[i];
      m[v[i].length()]++;
    }
    cin >> s;
    l = s.length();
    auto itr = m.begin();
    while ((itr->first) != l) {
      sum += (itr->second);
      itr++;
    }
    y = sum;
    sum1 = (itr->second);
    sum1 += (((sum + sum1 - 1) / k) * 5);
    sum += ((sum / k) * 5);
    cout << sum + 1 << " " << y + sum1;
  }
  return 0;
}
