#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, c, d;
  vector<int> v;
  string s, p;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> s;
    int len = s.size();
    v.push_back(len);
  }
  cin >> p;
  int l = p.size();
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++)
    if (v[i] == l) {
      c = i + 1;
      break;
    }
  for (int i = n - 1; i >= 0; i--)
    if (v[i] == l) {
      d = i + 1;
      break;
    }
  int ans = ((c - 1) / k) * 5 + c;
  int ans1 = ((d - 1) / k) * 5 + d;
  cout << ans << " " << ans1;
  return 0;
}
