Akm[k_,m_]:=Piecewise[{{0, (k != 1 && k != 3 && k != 5) || (k != 3 && k != 5 && m != -1 && m != 1) || (k != 5 && m != -3 && m != -2 && m != -1 && m != 1 && m != 2 && m != 3) || (m != -5 && m != -4 && m != -3 && m != -2 && m != -1 && m != 1 && m != 2 && m != 3 && m != 4 && m != 5)}, {-A[1, 1], k == 1 && m == -1}, {A[1, 1], k == 1 && m == 1}, {-A[3, 3], k == 3 && m == -3}, {(-I)*B[3, 2], k == 3 && m == -2}, {-A[3, 1], k == 3 && m == -1}, {A[3, 1], k == 3 && m == 1}, {I*B[3, 2], k == 3 && m == 2}, {A[3, 3], k == 3 && m == 3}, {-A[5, 5], k == 5 && m == -5}, {(-I)*B[5, 4], k == 5 && m == -4}, {-A[5, 3], k == 5 && m == -3}, {(-I)*B[5, 2], k == 5 && m == -2}, {-A[5, 1], k == 5 && m == -1}, {A[5, 1], k == 5 && m == 1}, {I*B[5, 2], k == 5 && m == 2}, {A[5, 3], k == 5 && m == 3}, {I*B[5, 4], k == 5 && m == 4}}, A[5, 5]]