#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long sum = (n + 1) * n / 2;
  long long msum = sum - ((n - k + 1) * (n - k) / 2);
  vector<long long> b;
  for (int i = 0; i < n; i++) {
    if (a[i] > n - k) {
      b.push_back(i + 1);
    }
  }
  long long c = 1;
  for (int i = 0; i < b.size() - 1; i++) {
    c = c * (b[i + 1] - b[i]) % 998244353;
  }
  cout << msum << " " << c << endl;
  return 0;
}
