#include <bits/stdc++.h>
using namespace std;
int n, k, matched, matchlen;
string str[105], key;
vector<string> v[105];
int ans = 0;
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) {
    cin >> str[i];
    int sz = str[i].size();
    v[sz].push_back(str[i]);
  }
  cin >> key;
  for (int i = 1; i <= n; i++) {
    if (str[i] == key) {
      matchlen = str[i].size();
      break;
    }
  }
  for (int i = 0; i <= matchlen; i++) {
    sort(v[i].begin(), v[i].end());
    v[i].erase(unique(v[i].begin(), v[i].end()), v[i].end());
  }
  int cnt = 0;
  for (int i = 0; i < matchlen; i++) cnt += v[i].size();
  int ans = 0;
  ans += cnt;
  ans += (cnt / k) * 5;
  cnt %= k;
  ans -= cnt;
  int best = ans, worst = ans;
  int nowcnt = cnt;
  nowcnt += v[matchlen].size();
  worst += nowcnt;
  worst += (nowcnt / k) * 5;
  worst -= (nowcnt % k == 0 ? 5 : 0);
  nowcnt = cnt;
  nowcnt++;
  best += nowcnt;
  best += (nowcnt / k) * 5;
  best -= (nowcnt % k == 0 ? 5 : 0);
  printf("%d %d\n", best, worst);
}
