#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
template <class T>
T max(T a, T b, T c) {
  return ((a > b) ? ((a > c) ? a : c) : ((b > c) ? b : c));
}
template <class T>
T min(T a, T b, T c) {
  return ((a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c));
}
const int MOD = (1e9) + 7;
const int MAXN = (1e5) + 9;
int T = 1, N = 1;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  while (T--) {
    int n, k;
    cin >> n >> k;
    vector<string> vec(n);
    string pswd;
    vector<int> len(101);
    for (int i = 0; i < n; i++) {
      cin >> vec[i];
      len[vec[i].length()]++;
    }
    cin >> pswd;
    sort(vec.begin(), vec.end());
    for (int i = 1; i < 101; i++) {
      len[i] = len[i] + len[i - 1];
    }
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      if (vec[i] == pswd) {
        cnt++;
      }
    }
    int mn = ((pswd.length() > 1) ? len[pswd.length() - 1] : 0);
    mn = mn + (mn / k) * 5;
    int mx = len[pswd.length()] - cnt;
    mx = mx + (mx / k) * 5;
    cout << mn + 1 << " " << mx + 1 << "\n";
  }
  return 0;
}
