#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false), cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  string a[101];
  for (int i = 0; i < n; i++) cin >> a[i];
  string ans;
  cin >> ans;
  long long x = 0, y = 0, t = 0;
  for (int i = 0; i < n; i++) {
    if (ans.size() > a[i].size()) x++;
    if (ans.size() < a[i].size()) y++;
    if (ans.size() >= a[i].size()) t++;
  }
  if (y == n) {
    cout << 1 << " " << 1;
    return 0;
  }
  if (x == 0)
    cout << 1 << " ";
  else if (x == n) {
    int x = 0, j = 0;
    for (int i = 0; i < n - 1; i++) {
      x++;
      j++;
      if (j == k) {
        x += 5;
        j = 0;
      }
    }
    cout << x + 1 << " " << x + 1;
    return 0;
  } else if (k > x)
    cout << x + 1 << " ";
  else {
    long long d = x / k;
    while (d--) x += 5;
    cout << x + 1 << " ";
  }
  if (k > n)
    cout << n;
  else {
    long long x = 0, j = 0;
    for (int i = 0; i < t - 1; i++) {
      x++;
      j++;
      if (j == k) {
        x += 5;
        j = 0;
      }
    }
    cout << x + 1;
  }
  return 0;
}
