#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  while (cin >> n >> k) {
    string s;
    map<int, int> m;
    map<int, bool> f;
    for (int i = 0; i < n; ++i) {
      cin >> s;
      if (!f[s.length()]) {
        f[s.length()] = 1;
        m[s.length()] = 1;
      } else
        ++m[s.length()];
    }
    cin >> s;
    int Min = 0, Max = 0;
    int temp = 0;
    for (map<int, int>::iterator it = m.begin(); it != m.end(); ++it) {
      if (it->first < s.length())
        temp += it->second;
      else {
        int i = 0;
        while (i < temp) {
          ++i;
          ++Min;
          if (i % k == 0) Min += 5;
        }
        ++Min;
        i = 0;
        while (i < temp + it->second - 1) {
          ++i;
          ++Max;
          if (i % k == 0) Max += 5;
        }
        ++Max;
        cout << Min << " " << Max << "\n";
        break;
      }
    }
  }
}
