#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  int len[110] = {0};
  cin >> n >> k;
  string str[n];
  string pass;
  for (int i = 0; i < n; i++) {
    cin >> str[i];
    len[str[i].length()]++;
  }
  cin >> pass;
  int passlen = pass.length();
  int best = 0, worst = 0, cnt = 0;
  for (int i = 0; i < n; i++) {
    if (str[i].length() < passlen)
      best++;
    else if (str[i].length() == passlen)
      worst++;
  }
  int ans1 = best + (best / k) * 5 + 1;
  int ans2 = worst + ((worst + best - 1) / k) * 5 + best;
  cout << ans1 << " " << ans2 << endl;
  return 0;
}
