#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k, l;
  string str;
  cin >> n >> k;
  while (n--) {
    cin >> str;
    l = str.length();
    mp[l]++;
  }
  cin >> str;
  l = str.length();
  long long cnt = 0, minRes = 0, maxRes = 0, p = 0;
  for (auto kv : mp) {
    if (kv.first < l)
      cnt += kv.second;
    else {
      minRes = cnt + (cnt / k) * 5;
      if (cnt > k)
        p = cnt % k;
      else if (cnt < k)
        p = cnt;
      cnt = kv.second - 1;
      maxRes = minRes + cnt + ((cnt + p) / k) * 5 + 1;
      break;
    }
  }
  cout << minRes + 1 << " " << maxRes << endl;
  return 0;
}
