#include <bits/stdc++.h>
using namespace std;
const int mxN = 1e5;
void solve() {
  string pass, s[200];
  int n, k;
  cin >> n >> k;
  int mi = 0, ma = 0;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  cin >> pass;
  for (int i = 0; i < n; i++) {
    if (pass.size() > s[i].size()) {
      mi++;
    }
    if (pass.size() < s[i].size()) {
      ma++;
    }
  }
  int t = 0;
  int temp = 0;
  if ((n - ma) % k == 0) {
    temp = -5;
  }
  cout << mi + 1 + mi / k * 5 << ' ' << (n - ma) + (n - ma) / k * 5 + temp;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  while (T--) {
    solve();
    cout << "\n";
  }
  return 0;
}
