Understanding the linear expenditure system I've been reading up on the uses of the linear expenditure system via a the papers which apply them. 

One paper which gives a good introduction to the topic in a paper called:
Modeling household behavior in a CGE model:
linear expenditure system or indirect addilog? by Paul de Boer. (pages 5-6) It goes through the basic theory behind the linear expenditure system fairly well. 

However in terms of working out the mathematics myself i'm having some difficulty, below is an abridged version of what is found in the paper.


  To derive the linear expenditure system we have:
  $$\max \ \ \ \ \ \ U(x_1,...,x_n)=\sum_{i=1}^n\gamma_i ln(x_i-a_i)$$
  $$s.t.\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ m=\sum_{i=1}^n p_ix_i$$
  
  After computing this we should get our linear expenditure system which is defined as:
  
  $$p_ix_i=p_ia_i+ \gamma_i(m-\sum_{j}p_{j}a_j)$$
  
  where 
  $(m-\sum_{j}p_{j}a_j)$ is  supernumerary or discretionary expenditure.


This is not what I got.

when solving this I end up with this (like how it was previously derived on Linear Expenditure System of Demands, Derivation Help):

$$\sum_{i=1}^nx_i=(a_1,...,a_n)+\left(\frac{\gamma_1}{\lambda p_1},...,\frac{\gamma_1}{\lambda p_1}\right)$$

How do i get the result like that in this paper?
For every $x_i$ separately you get

$$\frac {\gamma_i}{x_i-a_i} = \lambda p_i \tag{1}$$

Re-arranging,

$$\frac {\gamma_i}{\lambda} = p_ix_i - p_ia_i \tag{2}$$

Sum over $i$

$$\frac 1{\lambda}\sum\gamma_i = \sum p_ix_i - \sum p_ia_i \tag{3}$$

Re-arrange to solve for the optimal $\lambda$ taking into account the restrictions

$$\sum p_ix_i = m ,\;\;\; \sum\gamma_i=1$$

$$\lambda^* = \frac {1}{m-\sum p_ia_i}\tag {4}$$

Insert into $(2)$, re-arrange and you 're done.