#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  long long arr[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long ans1 = 0;
  map<long long, long long> mp;
  for (long long i = 0; i < k; i++) {
    ans1 += n - i;
    mp[n - i] = 1;
  }
  long long ans2 = 0;
  long long diff = 1;
  long long idx = 0;
  while (idx < n) {
    if (mp[arr[idx]]) {
      if (ans2 == 0) {
        ans2 = 1;
      } else {
        ans2 = diff * ans2;
        ans2 = ans2 % 998244353;
      }
      diff = 1;
    } else {
      diff++;
    }
    idx++;
  }
  while (ans2 < 0) {
    ans2 = ans2 + 998244353;
  }
  cout << ans1 << " " << ans2 << endl;
}
