#include <bits/stdc++.h>
using namespace std;
int main() {
  long n, m;
  while (cin >> n >> m) {
    string s[10010], s1;
    long l, k = 0, b, c = 0, a[10000] = {0};
    for (int i = 0; i < n; i++) {
      cin >> s[i];
      a[i] = s[i].size();
    }
    cin >> s1;
    l = s1.size();
    for (int i = 0; i < n; i++) {
      if (s[i].size() < l) {
        c++;
        k++;
      }
      if (c == m) {
        k += 5;
        c = 0;
      }
    }
    cout << k + 1 << " ";
    for (int i = 0; i < n; i++) {
      if (s[i] != s1 && s[i].size() == l) {
        c++;
        k++;
      }
      if (c == m) {
        k += 5;
        c = 0;
      }
    }
    cout << k + 1 << "\n";
  }
  return 0;
}
