#include <bits/stdc++.h>
using namespace std;
string ss;
int a[110];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> ss;
    a[i] = ss.size();
  }
  cin >> ss;
  int l = ss.size();
  sort(a, a + n);
  int MIN = 1, MAX = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] < l) MIN++;
    if (a[i] <= l) MAX++;
  }
  cout << MIN + (MIN - 1) / k * 5 << " " << MAX + (MAX - 1) / k * 5 << endl;
  return 0;
}
