#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  long long p[n];
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  long long ans1 = n * (n + 1) / 2 - (n - k) * (n - k + 1) / 2;
  cout << ans1 << " ";
  int i;
  for (i = 0; i < n; i++) {
    if (p[i] > n - k) {
      break;
    }
  }
  long long com = 1, rem = 998244353;
  long long ans2 = 1;
  for (int j = i + 1; j < n; j++) {
    if (p[j] > n - k) {
      ans2 = ((ans2 % rem) * (com % rem)) % rem;
      com = 1;
    } else {
      com++;
    }
  }
  cout << ans2;
}
