#include <bits/stdc++.h>
using namespace std;
long long MOD = 998244353;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  long long n, k;
  cin >> n >> k;
  long long m = 0;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  for (long long i = n; i > n - k; i--) {
    m += i;
  }
  vector<long long> ind;
  for (long long i = 0; i < n; i++) {
    if (v[i] > n - k) ind.push_back(i);
  }
  long long x = 1;
  for (long long i = 1; i < ind.size(); i++) {
    x *= ind[i] - ind[i - 1];
    x %= MOD;
  }
  cout << m << " " << x;
}
