#include <bits/stdc++.h>
using namespace std;
int main() {
  string mima[1002], z;
  int n, k, a = 0, b = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> mima[i];
  }
  cin >> z;
  int rule = z.size();
  for (int i = 0; i < n; i++) {
    if ((int)mima[i].size() < rule)
      a++;
    else if ((int)mima[i].size() == rule)
      b++;
  }
  cout << (a / k) * 5 + a + 1 << " " << ((a + b - 1) / k) * 5 + a + b;
  return 0;
}
