#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
long long inf = 1e15;
long long m_inf = INT_MIN;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  std::cout.unsetf(std::ios::floatfield);
  std::cout.precision(15);
  long long n, k;
  cin >> n >> k;
  long long ans;
  ans = n * (n + 1) / 2 - (n - k) * (n - k + 1) / 2;
  cout << ans << ' ';
  if (k == 1 || k == n) {
    cout << 1 << endl;
    return 0;
  }
  vector<long long> arr(n);
  vector<long long> pos(n);
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    arr[i]--;
    pos[arr[i]] = i;
  }
  vector<long long> indices;
  for (long long i = n - 1; i >= n - k; i--) {
    indices.push_back(pos[i]);
  }
  sort(indices.begin(), indices.end());
  long long tot = 1;
  for (long long i = 0; i < indices.size() - 1; i++) {
    tot = (tot * (indices[i + 1] - indices[i]) % mod) % mod;
  }
  cout << tot << '\n';
}
