#include <bits/stdc++.h>
using namespace std;
const int MAXN = 252, MAXM = 28;
int V, E;
int cap[85000], flow[85000];
int cost[85000], dist[540], pot[540];
int to[85000], prv[85000], last[540], path[540];
bool used[540];
priority_queue<pair<int, int> > q;
class MinCostFlow {
 public:
  MinCostFlow(int n);
  void add_edge(int x, int y, int w, int c);
  pair<int, int> search(int s, int t);
  pair<int, int> mincostflow(int s, int t);
  vector<pair<int, int> > flow_edges(void);
};
vector<pair<int, int> > MinCostFlow::flow_edges(void) {
  int x, e;
  vector<pair<int, int> > ans;
  for ((x) = 0; (x) < (int)(V); (x)++)
    for (e = last[x]; e >= 0; e = prv[e])
      if (flow[e] > 0) ans.push_back(make_pair(x, to[e]));
  return ans;
}
MinCostFlow::MinCostFlow(int n) {
  V = n;
  E = 0;
  int i;
  for ((i) = 0; (i) < (int)(V); (i)++) last[i] = -1;
}
void MinCostFlow::add_edge(int x, int y, int w, int c) {
  cap[E] = w;
  flow[E] = 0;
  cost[E] = c;
  to[E] = y;
  prv[E] = last[x];
  last[x] = E;
  E++;
  cap[E] = 0;
  flow[E] = 0;
  cost[E] = -c;
  to[E] = x;
  prv[E] = last[y];
  last[y] = E;
  E++;
}
pair<int, int> MinCostFlow::search(int s, int t) {
  int ansf = 0;
  int ansc = 0;
  int i;
  for ((i) = 0; (i) < (int)(V); (i)++) used[i] = false;
  for ((i) = 0; (i) < (int)(V); (i)++) dist[i] = (1 << 29);
  dist[s] = 0;
  path[s] = -1;
  q.push(make_pair(0, s));
  while (!q.empty()) {
    int x = q.top().second;
    q.pop();
    if (used[x]) continue;
    used[x] = true;
    for (int e = last[x]; e >= 0; e = prv[e])
      if (cap[e] > 0) {
        int tmp = dist[x] + cost[e] + pot[x] - pot[to[e]];
        if (tmp < dist[to[e]] && !used[to[e]]) {
          dist[to[e]] = tmp;
          path[to[e]] = e;
          q.push(make_pair(-dist[to[e]], to[e]));
        }
      }
  }
  for ((i) = 0; (i) < (int)(V); (i)++) pot[i] += dist[i];
  if (used[t]) {
    ansf = (1 << 29);
    for (int e = path[t]; e >= 0; e = path[to[e ^ 1]]) ansf = min(ansf, cap[e]);
    for (int e = path[t]; e >= 0; e = path[to[e ^ 1]]) {
      ansc += cost[e] * ansf;
      cap[e] -= ansf;
      flow[e] += ansf;
      cap[e ^ 1] += ansf;
      flow[e ^ 1] -= ansf;
    }
  }
  return make_pair(ansf, ansc);
}
pair<int, int> MinCostFlow::mincostflow(int s, int t) {
  int ansf = 0;
  int ansc = 0;
  int i;
  for ((i) = 0; (i) < (int)(V); (i)++) pot[i] = 0;
  while (1) {
    pair<int, int> p = search(s, t);
    if (!used[t]) break;
    ansf += p.first;
    ansc += p.second;
  }
  return make_pair(ansf, ansc);
}
int a[MAXN], par[MAXN], var[MAXN];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  MinCostFlow mcf(2 * n + m + 2);
  for (int i = 0; i < n; i++)
    for (int j = n + i + 1; j < 2 * n; j++)
      mcf.add_edge(i, j, 1,
                   (a[i] == a[j - n] ? 0 : __builtin_popcount(a[j - n])));
  for (int i = 2 * n; i < 2 * n + m; i++)
    for (int j = n; j < 2 * n; j++)
      mcf.add_edge(i, j, 1, __builtin_popcount(a[j - n]));
  for (int i = 0; i < n; i++) mcf.add_edge(2 * n + m, i, 1, 0);
  for (int i = 0; i < m; i++) mcf.add_edge(2 * n + m, 2 * n + i, 1, 0);
  for (int i = n; i < 2 * n; i++) mcf.add_edge(i, 2 * n + m + 1, 1, 0);
  int min_cost = mcf.mincostflow(2 * n + m, 2 * n + m + 1).second;
  vector<pair<int, int> > edges = mcf.flow_edges();
  for (int i = 0; i < edges.size(); i++) {
    int u = edges[i].second;
    if (u >= n && u < 2 * n) par[u - n] = edges[i].first;
  }
  vector<string> ans;
  for (int i = 0; i < n; i++)
    if (par[i] >= n) {
      var[i] = par[i] - 2 * n;
      char cvar = 'a' + var[i];
      stringstream ss;
      ss << cvar << '=' << a[i];
      ans.push_back(ss.str());
      ans.push_back("print(" + string(1, cvar) + ")");
    } else {
      var[i] = var[par[i]];
      char cvar = 'a' + var[i];
      if (a[i] != a[par[i]]) {
        stringstream ss;
        ss << cvar << '=' << a[i];
        ans.push_back(ss.str());
      }
      ans.push_back("print(" + string(1, cvar) + ")");
    }
  printf("%lu %d\n", ans.size(), min_cost);
  for (int i = 0; i < ans.size(); i++) printf("%s\n", ans[i].c_str());
  return 0;
}
