#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, k;
  cin >> n >> k;
  long long arr[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long low = n - k;
  long long sum = ((n * (n + 1)) / 2) - ((low * (low + 1)) / 2);
  long long factor = 1;
  long long count = 1;
  bool first_found = false;
  for (long long i = 0; i < n; i++) {
    if (arr[i] > low) {
      count *= factor;
      count %= 998244353;
      first_found = true;
      factor = 1;
    } else if (first_found) {
      factor++;
    }
  }
  cout << sum << " " << (count % 998244353);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  solve();
  return 0;
}
