#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string p;
  int a[111] = {}, a1 = 0, a2 = 0, b = 0;
  vector<string> v(n);
  for (int i = 0; i < n; i++) cin >> v[i], a[v[i].length()]++;
  cin >> p;
  for (int i = 0; i < 111; i++) {
    if (i == p.length()) break;
    b += a[i];
  }
  a1 = b / k * 5 + b + 1;
  b += a[p.length()] - 1;
  a2 = b / k * 5 + b + 1;
  cout << a1 << " " << a2 << endl;
  return 0;
}
