#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 + 5;
char str[MAXN];
int ans[MAXN];
int n, k;
int main() {
  while (~scanf("%d%d", &n, &k)) {
    for (int i = 0; i < n; ++i) {
      scanf("%s", str);
      ++ans[strlen(str)];
    }
    scanf("%s", str);
    int len = strlen(str);
    int ans1 = 0, ans2 = 0, left = 0;
    for (int i = 1; i < MAXN; ++i) {
      if (i < len) {
        ans1 += ans[i];
        left += ans[i];
        ans1 += left / k * 5;
        left %= k;
      }
      if (i == len) {
        ans2 = ans1;
        ans1++;
        ans1 += left / k * 5;
        ans2 += ans[i];
        ans2 += (left + ans[i] - 1) / k * 5;
        break;
      }
    }
    printf("%d %d\n", ans1, ans2);
  }
}
