#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s[n], s1;
  int arr[n], b;
  int best = 0, t = 0;
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
    arr[i] = s[i].length();
  }
  sort(arr, arr + n);
  cin >> s1;
  b = s1.length();
  for (int i = 0; i < n; ++i) {
    if (arr[i] < b) {
      t++;
    } else if (arr[i] == b) {
      best++;
    }
  }
  cout << (t + 1 + (5 * (t / k))) << " "
       << (((((t + best) - 1) / k) * 5) + t + best);
}
