#include <bits/stdc++.h>
using namespace std;
char s[10005];
int len[10005];
char num[10005][200];
char cc[200];
int main() {
  int n, k;
  while (scanf("%d%d", &n, &k) != EOF) {
    for (int i = 1; i <= n; i++) {
      scanf("%s", num[i]);
      len[i] = strlen(num[i]);
    }
    scanf("%s", cc);
    int ll = strlen(cc);
    int minn = 1;
    int maxx = 0;
    for (int i = 1; i <= n; i++) {
      if (len[i] < ll) {
        minn++;
      }
      if (len[i] <= ll) {
        maxx++;
      }
    }
    printf("%d %d\n", minn + (minn - 1) / k * 5, maxx + (maxx - 1) / k * 5);
  }
}
