#include <bits/stdc++.h>
using namespace std;
pair<string, int> pr[1234];
int main() {
  long long int n, k;
  cin >> n >> k;
  string ls;
  string s[n];
  for (long long int i = 0; i < n; i++) {
    cin >> s[i];
    pr[i] = {s[i], s[i].size()};
  }
  cin >> ls;
  long long int a = ls.length();
  long long int c = 0;
  for (long long int i = 0; i < n; i++) {
    if (a > pr[i].second) c++;
  }
  cout << 1 + c + (c / k) * 5 << " ";
  long long int m = 0;
  for (long long int i = 0; i < n; i++) {
    if (a == pr[i].second) m++;
  }
  cout << c + m + ((c + m - 1) / k) * 5 << endl;
}
